|
From: Thomas B. <bar...@gm...> - 2016-12-30 07:19:07
|
Hi, I would like to iterate over code-blocks of a Markdown document without
rendering it to anything. I can do it easely with Python-Markdown, but I can't
manage to add the fenced block extension. My code is:
import markdown
from markdown.extensions.fenced_code import FencedCodeExtension
M = markdown.Markdown()
FencedCodeExtension().extendMarkdown(M, markdown.__dict__)
f = open("demo.md", "r")
tree = M.parser.parseDocument(f.readlines())
f.close()
for k in tree.iter():
if k.tag == "code":
print(k)
print(k.text)
It still detects indented code-blocks but not the fenced blocks.
What am I doing wrong?
Thank you by advance,
regards,
--
tb.
|