我没有从Python Markdown的footnotes扩展中得到我期望的结果。在
import markdown
content = "Footnotes[^1] have a label[^@#$%] and the footnote's content.\
\
[^1]: This is a footnote content.\
[^@#$%]: A footnote on the label: @#$%."
htmlmarkdown=markdown.markdown( content, extensions=['footnotes'] )
print htmlmarkdown
结果是:
^{pr2}$这些脚注根本不解析!为什么?在
你的台词中没有新行。行尾的
\
只允许您将字符串放在多行上,它实际上不包括换行符。如果要显式地包含换行符,那么在行的开头会有太多的空白,而最终会得到一个<pre>
块。在下面,使用三重引号来保留换行符是有效的:
相关问题 更多 >
编程相关推荐