Reputation: 581
I generate Sphinx documentation with make html. Everything is ok with that. But when I use search feature, I get a link with search term appended, like this:
http://url/search.html?q=searched&check_keywords=yes&area=default
http://url/module.html?highlight=searched
The thing is the highlight ("searched" above) is always there. The only way to disable it is to edit URL in the browser manually.
Is there any other way to get link to the document without highlight part?
Platform: windows
Sphinx version: 1.1.3
Regards, Robert
Upvotes: 14
Views: 1008
Reputation: 50957
The highlighted text is rendered by a <span class="highlighted">searched</span>
element. The default CSS rule (in basic.css) is this:
dt:target, span.highlighted {
background-color: #fbe54e;
}
You can override this rule in a custom CSS file (let's call it custom.css) with this content:
/* Assume that the 'alabaster' theme is used */
@import url("alabaster.css");
/* No search term highlighting */
span.highlighted {
background-color: transparent;
}
Put custom.css in the _static
folder of your Sphinx project and add or modify the following lines in conf.py:
html_static_path = ["_static"]
html_style = "custom.css"
The above disables highlighting on the "search results" page and on each linked page.
Tested with Sphinx 1.6.5 (1.1.3 is quite old).
Upvotes: 4