Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

No ids for headers #74

Open
geekyogurt opened this issue Sep 20, 2019 · 4 comments
Open

No ids for headers #74

geekyogurt opened this issue Sep 20, 2019 · 4 comments

Comments

@geekyogurt
Copy link

Flask Misaka, unlike jekyll and python markdown library doesnot add id to headings.

@FSX
Copy link
Owner

FSX commented Sep 20, 2019

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.

@geekyogurt
Copy link
Author

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)

@FSX
Copy link
Owner

FSX commented Sep 24, 2019

@geekyogurt Sorry, I was busy. I'll reply with an answer to your question tonight.

Repository owner deleted a comment from kingclowndean Sep 24, 2019
@FSX
Copy link
Owner

FSX commented Sep 24, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants