mistune-contrib icon indicating copy to clipboard operation
mistune-contrib copied to clipboard

TOC API is overcomplicated

Open techtonik opened this issue 10 years ago • 2 comments

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)

techtonik avatar Sep 12 '15 19:09 techtonik

Take a look how nice interface was turned into somewhat messy https://github.com/gratipay/inside.gratipay.com/pull/339/files

techtonik avatar Sep 12 '15 19:09 techtonik

@techtonik I used TocMixin instead TocRenderer because we will always use a custom renderer.

lepture avatar Sep 20 '15 12:09 lepture