FSX / misaka

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

AttributeError: module 'misaka' has no attribute 'HtmlRenderer' #55

Closed rebootl closed 7 years ago

rebootl commented 8 years ago

Trying the example from the docs I get this:

Traceback (most recent call last):
  File "./misaka.py", line 3, in <module>
    import misaka as m
  File "..test/misaka.py", line 8, in <module>
    class HighlighterRenderer(m.HtmlRenderer):
AttributeError: module 'misaka' has no attribute 'HtmlRenderer'
#!/usr/bin/python
#import houdini as h
import misaka as m
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name

class HighlighterRenderer(m.HtmlRenderer):
    def blockcode(self, text, lang):
        if not lang:
            return '\n<pre><code>{}</code></pre>\n'.format(text.strip())
                #h.escape_html(text.strip()))

        lexer = get_lexer_by_name(lang, stripall=True)
        formatter = HtmlFormatter()

        return highlight(text, lexer, formatter)

renderer = HighlighterRenderer()
md = m.Markdown(renderer, extensions=('fenced-code',))

print(md("""
Here is some code:

```python
print(123)

More code:

print(123)

"""))

v. 2.0.0 on Arch Linux (AUR PKGBUILD)
Am I missing something ?
FSX commented 8 years ago

Are you sure you have the right package? The code from the docs work here.