Closed tvmaly closed 1 year ago
Related/duplicate of https://github.com/miyuchina/mistletoe/issues/4
@SomeoneSerge is correct. I.e. right now, there is no MarkdownRenderer
, but it is being worked on (namely in #162).
@tvmaly, I hope that this answers your question. :)
Note to others who wind up here; now that we have MarkdownRenderer
class see its sub-section in https://github.com/miyuchina/mistletoe?tab=readme-ov-file#usage-from-python
... Maybe something like this...
with MarkdownRenderer(max_line_length=20) as renderer:
print(renderer.render(mistletoe.Document(fin)))
@codekiln, thanks for the update. Some more info then:
1) The thing is one can use MarkdownRenderer
as any other renderer in mistletoe. While of course, it has got special options like max_line_length
which can be passed to the constructor (see its pydoc).
2) Also note that there is this dedicated Markdown to Markdown parsing-and-rendering chapter available in the Developer's Guide, which shows how to modify the AST before rendering it back to markdown.
Could you add an example on how to take an AST of the markdown, modify it then write out the result to markdown?