quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.89k stars 321 forks source link

Add a class that excludes blocks of text from being added to the OOTB Quarto search index (search.json) #11189

Open nickvigilante opened 3 hours ago

nickvigilante commented 3 hours ago

Our use case:

We have several {{< embed >}} blocks across our documentation, some of which reference the outputs of running the tree command on certain folders. The tree output contains a bunch of names and terms that are used frequently across different areas of our product. If we happen to search for one of the terms that matches a directory of the tree output, we get a bunch of irrelevant results. For example, let's say I search for enumerations:

Image

The page includes references to an enumerations folder, but the page itself isn't about enumerations.

Image

I'd like the ability to add a class to a div or a span block and have Quarto strip that block out before it enters search.json.

mcanouil commented 3 hours ago

For reference

cscheid commented 3 hours ago

If you can put together a PR against src/project/types/website/website-search.ts, we can iterate on it.