Allow TOC element to use a custom CSS class · Issue #1224 · Python-Markdown/markdown (original) (raw)
will currently generate the following HTML:
Header 1
The class="toc"
cannot be changed, although using custom classes are supported for anchorlinks (anchorlink_class
) and permalinks (permalink_class
).
I suggest that another config parameter toc_class
that defaults to the current class toc
is introduced. This is useful if in use with CSS frameworks that apply certain styles to prose content but allow disabling the additional styles when a certain class is present. For TailwindCSS, the extension could be called like so:
md = markdown.Markdown(extensions=[TocExtension(toc_class="toc not-prose")]