Skip to content

Commit 369dc53

Browse files
authored
Export a SUPPORTED_BUILDERS list (#8)
1 parent 057773b commit 369dc53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/sphinxnotes/strike/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616
from docutils.parsers.rst.states import Inliner
1717

1818
from sphinx.application import Sphinx
19+
from sphinx.builders import Builder
1920
from sphinx.builders.html import StandaloneHTMLBuilder
2021
from sphinx.builders.latex import LaTeXBuilder
2122

2223
from . import meta
2324

2425

26+
# List of all builders that support render :class:`strike_node`.
27+
SUPPORTED_BUILDERS: list[type[Builder]] = [StandaloneHTMLBuilder, LaTeXBuilder]
28+
2529
class strike_node(nodes.Inline, nodes.TextElement):
2630
pass
2731

@@ -37,7 +41,7 @@ def strike_role(
3741
) -> Tuple[List[Node], List[system_message]]:
3842
env = inliner.document.settings.env # type: ignore
3943

40-
if not isinstance(env.app.builder, (StandaloneHTMLBuilder, LaTeXBuilder)):
44+
if not isinstance(env.app.builder, tuple(SUPPORTED_BUILDERS)):
4145
# Builder is not supported, fallback to text.
4246
return [Text(unescape(text))], []
4347

0 commit comments

Comments
 (0)