Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search does not handle headers with special formatting. #720

Closed
ehuss opened this issue Jul 4, 2018 · 1 comment · Fixed by #1749
Closed

Search does not handle headers with special formatting. #720

ehuss opened this issue Jul 4, 2018 · 1 comment · Fixed by #1749
Labels
A-Search Area: Search E-Help-wanted Experience: Help Needed

Comments

@ehuss
Copy link
Contributor

ehuss commented Jul 4, 2018

When headers have special formatting, the search results do not have the correct # anchor links.

Example:
### The `[profile.*]` sections

has an anchor hash of #the-profile-sections but the search index uses a hash of #the--profile--sections (notice the extra dashes).

It also does not handle duplicate header names.

I looked at it briefly. The issue is that the anchor id is generated from the HTML content (here), and has special logic for striping out certain tags such as <code>. However, the search code re-parses the content, and replaces all tags with a single space (here).

I'm not sure what the best solution is. Some options I can think of:

  • Don't insert a space in the header for Events. I'm not sure which scenarios that would cause problems, but the common inline tags (code, strong, em) are normally surrounded by spaces already.
  • Check for Events that match the same list in id_from_content() and not insert a space in header in those situations.
  • Collapse duplicate whitespace in normalize_id into a single whitespace.
@ehuss
Copy link
Contributor Author

ehuss commented May 24, 2021

Note: The example listed above was fixed some time before 0.3.0. I think it was due to a change in pulldown_cmark which trimed whitespace from the text strings. However, the way the IDs are generated are still different codepaths with subtle differences. The biggest remaining issue is that duplicate IDs are not handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Search Area: Search E-Help-wanted Experience: Help Needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant