lepture / mistune-contrib

Contribution for mistune.
BSD 3-Clause "New" or "Revised" License
40 stars 17 forks source link

TOC API is overcomplicated #4

Open techtonik opened 9 years ago

techtonik commented 9 years ago

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 commented 9 years ago

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

lepture commented 9 years ago

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