annikwag commited on
Commit
5e4d104
·
verified ·
1 Parent(s): 1619e8d

Update appStore/rag_utils.py

Browse files
Files changed (1) hide show
  1. appStore/rag_utils.py +3 -4
appStore/rag_utils.py CHANGED
@@ -39,17 +39,16 @@ def build_context_for_result(res, compute_title_fn):
39
 
40
  def highlight_query(text, query):
41
  """
42
- Highlight the query text in the given string with red/bold HTML styling.
43
-
44
  Args:
45
  text (str): The full text in which to highlight matches.
46
  query (str): The substring (query) to highlight.
47
 
48
  Returns:
49
- str: The HTML-formatted string with highlighted matches.
50
  """
51
  pattern = re.compile(re.escape(query), re.IGNORECASE)
52
- return pattern.sub(lambda m: f"<span style='color:red; font-weight:bold;'>{m.group(0)}</span>", text)
53
 
54
  def format_project_id(pid):
55
  """
 
39
 
40
  def highlight_query(text, query):
41
  """
42
+ Highlight the query text in the given string with simple bold markdown.
 
43
  Args:
44
  text (str): The full text in which to highlight matches.
45
  query (str): The substring (query) to highlight.
46
 
47
  Returns:
48
+ str: The markdown-formatted string with highlighted matches.
49
  """
50
  pattern = re.compile(re.escape(query), re.IGNORECASE)
51
+ return pattern.sub(lambda m: f"**{m.group(0)}**", text)
52
 
53
  def format_project_id(pid):
54
  """