misaka
misaka copied to clipboard
No ids for headers
Flask Misaka, unlike jekyll and python markdown library doesnot add id to headings.
How are you using Misaka? Do you have a code snippet?
To include IDs you can pass nesting_level to HtmlRenderer. See: https://misaka.61924.nl/#misaka.HtmlRenderer
It's not a very friendly API now that I look at it.
I am using Flask-Misaka.https://github.com/singingwolfboy/flask-misaka {{data|markdown}} in html and initializing the app using: Misaka(app, fenced_code=True, tables=True, footnotes=True, toc=True,space_headers=True)
@geekyogurt Sorry, I was busy. I'll reply with an answer to your question tonight.
I'm guessing the following should work:
import misaka
Misaka(
app,
fenced_code=True,
tables=True,
footnotes=True,
space_headers=True,
renderer=HtmlRenderer(nesting_level=6),
)
I don't see a way to add a table of contents renderer into the current Flask-Misaka code. toc=True also isn't an argument I see in Flask-Misaka's code.
I'm guessing the HtmlRenderer class should be extended to generate a table of contents or Flask-Misaka extend's it API to add more than one template filter.