mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add optional css_selector arg to get_stylesheet
This commit is contained in:
parent
a4d4401fc4
commit
3f9be211ee
@ -10,7 +10,7 @@
|
||||
|
||||
from functools import partial
|
||||
from importlib import import_module
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, Union, Iterable
|
||||
|
||||
from pygments import highlight
|
||||
from pygments.filters import ErrorToken
|
||||
@ -157,9 +157,9 @@ class PygmentsBridge:
|
||||
# MEMO: this is done to escape Unicode chars with non-Unicode engines
|
||||
return texescape.hlescape(hlsource, self.latex_engine)
|
||||
|
||||
def get_stylesheet(self) -> str:
|
||||
def get_stylesheet(self, *, css_selector: Union[str, Iterable[str]] = '.highlight') -> str:
|
||||
formatter = self.get_formatter()
|
||||
if self.dest == 'html':
|
||||
return formatter.get_style_defs('.highlight')
|
||||
return formatter.get_style_defs(css_selector)
|
||||
else:
|
||||
return formatter.get_style_defs() + _LATEX_ADD_STYLES
|
||||
|
Loading…
Reference in New Issue
Block a user