File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616from pygments .token import Text
1717from sphinx .builders .html import StandaloneHTMLBuilder
1818from sphinx .environment .adapters .toctree import TocTree
19+ from sphinx .errors import ConfigError
1920from sphinx .highlighting import PygmentsBridge
2021from sphinx .transforms .post_transforms import SphinxPostTransform
2122
@@ -175,7 +176,7 @@ def _html_page_context(
175176) -> None :
176177 if "css_files" in context :
177178 if "_static/styles/furo.css" not in [c .filename for c in context ["css_files" ]]:
178- raise Exception (
179+ raise ConfigError (
179180 "This documentation is not using `furo.css` as the stylesheet. "
180181 "If you have set `html_style` in your conf.py file, remove it."
181182 )
@@ -220,14 +221,17 @@ def _html_page_context(
220221
221222def _builder_inited (app : sphinx .application .Sphinx ) -> None :
222223 if "furo" in app .config .extensions :
223- raise Exception (
224+ raise ConfigError (
224225 "Did you list 'furo' in the `extensions` in conf.py? "
225226 "If so, please remove it. Furo does not work with non-HTML builders "
226227 "and specifying it as an `html_theme` is sufficient."
227228 )
228229
229- if not isinstance (app .builder , StandaloneHTMLBuilder ):
230- raise Exception (
230+ if not isinstance (app .builder , StandaloneHTMLBuilder ) or app .builder .name not in {
231+ "html" ,
232+ "dirhtml" ,
233+ }:
234+ raise ConfigError (
231235 "Furo is being used as an extension in a non-HTML build. "
232236 "This should not happen."
233237 )
You can’t perform that action at this time.
0 commit comments