8000 Search: headings which contain inline code are incomplete when displayed in search results · Issue #6132 · squidfunk/mkdocs-material · GitHub
[go: up one dir, main page]

Skip to content

Search: headings which contain inline code are incomplete when displayed in search results #6132

@sarcastro

Description

@sarcastro

Context

No response

Bug description

When a heading contains inline code and search terms are contained within the heading itself, only the portions of the heading which matched the terms are displayed to the user, with the rest of the heading being omitted entirely.

The result of this is incomplete information being shown to the user and, depending on the text that's missing, can display confusing and/or factually incorrect results to the user.

Note: If the matched search term(s) are contained in the content beneath the heading only (i.e. not within the heading itself) then the headings are displayed properly.

Related links

  • Reporting a bug
  • I searched the documentation, discussions and issues to determine if this is expected behaviour and the closest I'm able to find is the Built-in typeset plugin documentation, which this behaviour does seem to contradict.

Reproduction

While I'm happy to provide this if needed, I don't think it provides any benefit in this particular case as the issue is easily reproducible without any special configuration and easily demonstrable using the official project documentation. In lieu of a reproduction .zip, I took screenshots of the official documentation and took care to ensure that they include the URL and version number in them. As such, these can be used as additional examples of steps of steps to reproduce.

Here are screenshots showing numerous ways the Creating a .zip file section in the official project documentation can be displayed depending on the search terms. Section is located on the Creating a reproduction page, coincidentally enough.

❌ Search for zip shows only Creating a .zip:
Screenshot 2023-10-04 000009

❌ Searching for file shows only file:
Screenshot 2023-10-04 000027

✔ Searching for text beneath shows the full heading properly (Creating a .zip file):
Screenshot 2023-10-04 000042

Here's another example, showing the same behaviour on a page heading (rather than section heading), using the Using git sparse-checkout for faster documentation builds page in the official project documentation:

❌ Searching for git sp shows only Using git sparse-checkout:
Screenshot 2023-10-04 003512

❌ Searching for docum shows only for faster documentation builds:
Screenshot 2023-10-04 003535

✔ As with the example above, searching for text beneath it shows the full heading correctly (Using git sparse-checkout for faster documentation builds):
Screenshot 2023-10-04 003620

If you'd still like a reproduction .zip, please just let me know and I'll be happy to provide one.

Steps to reproduce

1. Use inline code in a heading in a markdown file in the documentation.

e.g.
# PLEASE `DO` `NOT` TRY THIS AT HOME!!

2. Perform a search using the built-in search plugin.

A search for home results in: TRY THIS AT HOME:

image

A search for please results in: PLEASE DO:

image

(As a side note, I do see that the exclamation marks are missing too but I haven't investigated it well enough yet to be confident it's a bug. )

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0