FSX / misaka

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

can't process code block surrounded with ``` #52

Closed weaming closed 8 years ago

weaming commented 8 years ago

can't process code block surrounded with ``` such as

code
FSX commented 8 years ago

Did you enable the fenced codeblock extension?

misaka.html(text, extensions=('fenced-code',))

Or:

misaka.Markdown(renderer, extensions=('fenced-code',))
weaming commented 8 years ago

@FSX Can I set the default extensions value of this method to 'fenced-code'? Because I want to use:

md = misaka.html
md(text)

But don't want to change the md(text) part.

FSX commented 8 years ago

You mean this?

renderer = misaka.HtmlRenderer()
md = misaka.Markdown(renderer, extensions=('fenced-code',))

md(text)

Please read the documentation: http://misaka.61924.nl/

weaming commented 8 years ago

@FSX I think yes.Thanks very much for your reply. I will try it later.

The documentation is not accessed easily in China for the net reason, and the domain is so strange.

FSX commented 8 years ago

I see, you can also build the documentation yourself.

Go into the docs folder and run make html. A _build folder is created containing the HTML files.

weaming commented 8 years ago

@FSX It occured a EROOR:

 File "/data1/www/htdocs/462/codelog/1/handlers/content_handler.py", line 5, in <module>
    md = misaka.Markdown(renderer, extensions=('fenced-code',))
  File "misaka.pyx", line 194, in misaka.Markdown.__cinit__ (src/misaka.c:1481)
TypeError: an integer is required

I'm using misaka 1.0.2

weaming commented 8 years ago

I had fix this using the misaka.EXT_FENCED_CODE. But another problem appeared...

In version 1.0.2, must use render() function. ^_^

from misaka import Markdown, HtmlRenderer

rndr = HtmlRenderer()
md = Markdown(rndr)

print md.render('some text')
FSX commented 8 years ago

Yes, I've changed it in version 2.

weaming commented 8 years ago

@FSX You can visit my demo blog site http://codelog.sinaapp.com/