quarto-dev / quarto-dev/quarto-cli
Add $search-highlight-bg SCSS variable for search result highlight color
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Search result highlighting on destination pages (the ?q= parameter feature) uses bare <mark> elements, which inherit Bootstrap's default styling via $mark-bg / --bs-highlight-bg (yellow-100).
Users can already customize this through Bootstrap:
/*-- scss:defaults --*/
$mark-bg: #d1ecf1;
or via CSS:
:root {
--bs-highlight-bg: #d1ecf1;
}
However, $mark-bg affects all <mark> elements on the page, not just search highlights. It would be useful to have a Quarto-specific SCSS variable like $search-highlight-bg that targets only search result marks, and is documented alongside other SCSS variables at https://quarto.org/docs/output-formats/html-themes.html#sass-variables.
This could be implemented by adding a CSS class to the <mark> elements created in quarto-search.js (line 1138):
const markEl = txt => {
const el = document.createElement("mark");
el.appendChild(document.createTextNode(txt));
return el
}
and styling that class with a dedicated SCSS variable that falls back to $mark-bg.
Context: quarto-dev/quarto-web#1927 (review discussion)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at quarto-search.js line 1138, where search-result mark elements are created, and review the Sass-variable documentation at html-themes.html#sass-variables. The change is complete when search highlights can use a dedicated variable without changing unrelated mark elements, with the variable documented and its fallback behavior covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, scss
- Domain
- documentation, frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100