Skip to content

Conversation

@corvin-koegler
Copy link

Adding a space to numeric searches prevents markdown from breaking the search.

Issue 612

@frcroth
Copy link
Contributor

frcroth commented Oct 22, 2024

Can you explain why this happens?

@lukasrad02
Copy link
Contributor

This only fixes the symptom, but not the actual root cause.

The underlying problem of #612 is that the highlighting logic replaces substrings in the markdown text. So, for example, searching for "page" also breaks our internal links (in the form of [Text](page:123)). This query does not cause a internal server error, as the markdown renderer just uses **page**:123 as link target, but it still alters the meaning.

Hence, we either have to use a more sophisticated highlighting logic (parsing the markdown into an AST, then performing replacements only on textnodes and then writing the AST back to markdown), or have to remove the highlighting completely.

@corvin-koegler
Copy link
Author

For shits I changed the highlighting from matching in the source to matching in the rendered html and it mostly works. When you search for a page id it will show in the search but not highlight anything.

@lukasrad02
Copy link
Contributor

lukasrad02 commented Jul 23, 2025

I've checked out your branch and couldn't see any highlighting at all except for search results in the page title. Did you also experience this issue?

Also, I'm a bit afraid that rendering markdown twice might break under certain circumstances, e.g. escaped characters in the original markdown get converted into the plain character in the first rendering process, but as the markdown is rendered again, it might then be interpreted as some markdown element…
Edit: My fault, you're not rendering it twice but only swapped rendering and highlighting. However, in this case, there won't be any highlighting at all, as ** has no special meaning in HTML. This might also explain the issue I've mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants