zopieux / py-gfm

Github-Flavored Markdown for Python-Markdown.
https://pypi.org/project/py-gfm/
BSD 3-Clause "New" or "Revised" License
71 stars 14 forks source link

Anchors for headers #4

Closed brunobord closed 8 years ago

brunobord commented 8 years ago

Hello,

In GFM rendered on Github, markdown files have anchors allowing users to point at a specific section of the document. e.g.:

https://github.com/brunobord/the-black-hack/blob/master/french/the-black-hack.md#points-darmure or https://github.com/Zopieux/py-gfm/blob/master/CHANGELOG.md#011

Would it be possible to implement this in py-gfm?

brunobord commented 8 years ago

right, never mind, I've found it in the Markdown package documentation. It's doable like this:

        html = markdown.markdown(
            source,
            extensions=[
                GithubFlavoredMarkdownExtension(),
                'markdown.extensions.toc'
            ]
        )

And one can provide options to fit to their needs. https://pythonhosted.org/Markdown/extensions/toc.html

Sorry for the noise.