FSX / misaka

A Python binding for Hoedown.
http://misaka.61924.nl
MIT License
420 stars 65 forks source link

Wrong TOC parsed in code block #41

Closed NsLib closed 10 years ago

NsLib commented 10 years ago

I use the following code to generate markdown toc

class VimwikiTocRenderer(HtmlTocRenderer, LinkPreprocessor):
    pass
...
toc_renderer = VimwikiTocRenderer()
to_toc = Markdown(toc_renderer,
        extensions = EXT_NO_INTRA_EMPHASIS | EXT_AUTOLINK | EXT_SPACE_HEADERS)
toc_content = to_toc.render(input_file)

However when I use a python code block like below, it treated # -*- coding: utf-8 -*- as toc too.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import random
import sys

#...
FSX commented 10 years ago

If you're using EXT_FENCED_CODE to render the document you should also use it when rendering a TOC.

NsLib commented 10 years ago

Yep ~ I tried this and it works. thx so much~