added markdown.tab_length config option
This commit is contained in:
parent
99ad674f51
commit
85fa619828
2 changed files with 8 additions and 2 deletions
|
@ -38,6 +38,7 @@ class HighlightingConfig:
|
||||||
@dataclass
|
@dataclass
|
||||||
class MarkdownConfig:
|
class MarkdownConfig:
|
||||||
image_labels: bool = True
|
image_labels: bool = True
|
||||||
|
tab_length: int = 2
|
||||||
syntax_highlighting: HighlightingConfig = field(
|
syntax_highlighting: HighlightingConfig = field(
|
||||||
default_factory=HighlightingConfig
|
default_factory=HighlightingConfig
|
||||||
)
|
)
|
||||||
|
|
|
@ -144,15 +144,20 @@ def md_to_html(
|
||||||
MarkdownInHtmlExtension(),
|
MarkdownInHtmlExtension(),
|
||||||
EscapeAllExtension(hardbreak=True),
|
EscapeAllExtension(hardbreak=True),
|
||||||
]
|
]
|
||||||
|
kwargs: dict[str, Any] = {
|
||||||
|
"extensions": extensions,
|
||||||
|
"tab_length": 2,
|
||||||
|
}
|
||||||
if config:
|
if config:
|
||||||
extensions.append(
|
kwargs["extensions"].append(
|
||||||
CodeHiliteExtension(
|
CodeHiliteExtension(
|
||||||
linenums=False,
|
linenums=False,
|
||||||
noclasses=False,
|
noclasses=False,
|
||||||
pygments_style=config.markdown.syntax_highlighting.theme,
|
pygments_style=config.markdown.syntax_highlighting.theme,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
md = Markdown(extensions=extensions)
|
kwargs["tab_length"] = config.markdown.tab_length
|
||||||
|
md = Markdown(**kwargs)
|
||||||
if resolve_links:
|
if resolve_links:
|
||||||
if source is None or layout is None or item_map is None:
|
if source is None or layout is None or item_map is None:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue