mistune-contrib
mistune-contrib copied to clipboard
TOC API is overcomplicated
Instead of
import mistune
from mistune_contrib.toc import TocMixin
class TocRenderer(TocMixin, mistune.Renderer):
pass
toc = TocRenderer()
markdown = mistune.Markdown(renderer=toc)
toc = toc.reset_toc()
import mistune
from mistune_contrib.toc import TocRenderer
markdown = mistune.Markdown(renderer=TocRenderer)
Take a look how nice interface was turned into somewhat messy https://github.com/gratipay/inside.gratipay.com/pull/339/files
@techtonik I used TocMixin instead TocRenderer because we will always use a custom renderer.