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: code indentation lost in search index #6104

Closed
4 tasks done
iBug opened this issue Sep 30, 2023 · 5 comments
Closed
4 tasks done

Search: code indentation lost in search index #6104

iBug opened this issue Sep 30, 2023 · 5 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@iBug
Copy link
Contributor

iBug commented Sep 30, 2023

Context

No response

Bug description

If a code block is contained in an admonition, when this code block comes up in the search result, any indentation is lost.

Related links

Reproduction

9.4.2-test.zip

Steps to reproduce

The easier way: Searching for slugify in the official documentation, and look for this result:

image

The (entirely unnecessarily) more complex way: Using the supplied ZIP, search for test and see how the two results differ. index.md is unaffected while test.md is broken (in the search results).

Browser

Browser-agnostic

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting. We'll look into it. Regarding reproductions, our bug reporting guide explains why we need them:

Why we need this: if an issue contains no minimal reproduction or just a link to a repository with thousands of files, the maintainers would need to invest a lot of time into trying to recreate the right conditions to even inspect the bug, let alone fix it.

Minimal reproductions make our life easier, allowing us to fix bugs quicker. Thank you for providing one.

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Sep 30, 2023
@squidfunk
Copy link
Owner

So, in fact, all indentation is currently lost for code blocks in search – not all in admonitions. We'll look into it.

@squidfunk squidfunk changed the title Code indentation is lost in search result previews if the code block is nested inside an admonition Search: code indentation lost in search index Oct 1, 2023
@squidfunk squidfunk added bug Issue reports a bug and removed needs investigation Issue must be investigated by the maintainers labels Oct 1, 2023
@squidfunk
Copy link
Owner

Bisection leads to the insight that the error was introduced between 9.0.2 and 9.0.3, specifically in 81e7b8c.

@squidfunk
Copy link
Owner

Fixed in 8299f1d. The whitespace collapsing logic was triggering the problem.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Oct 2, 2023
@squidfunk
Copy link
Owner

Released as part of 9.4.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants