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
You can use the user-select property to disable text selection of an element. In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.
Remove highlighting from part or all of a document Select the text that you want to remove highlighting from, or press Ctrl+A to select all of the text in the document. Go to Home and select the arrow next to Text Highlight Color. Select No Color.
To change the look and feel of highlighted text on an HTML page you will use the ::selection operator. You can apply this operator as wide or as narrow as you see fit.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With