可能,问题出在我对应该发生的事情的理解上。下面是我所做的:
>>> import markdown2
>>> rawtext = "Getting the Gist of Markdown's Formatting Syntax ------------------------------------------------ This page offers a brief "
>>> html = markdown2.markdown(rawtext)
>>> html
u"<p>Getting the Gist of Markdown's Formatting Syntax ------------------------------------------------ This page offers a brief </p>\n"我尝试使用markdown而不是markdown2,但得到了相同的结果。我本以为许多“-”会导致“获得Markdown的格式语法要点”呈现为一个H1。我遗漏了什么?
发布于 2013-06-23 03:55:36
只有当破折号在文本下方各自的行上时,它才会呈现为<h1>:
>>> import markdown2
>>> rawtext = "Getting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\nThis page offers a brief "
>>> markdown2.markdown(rawtext)
u"<h2>Getting the Gist of Markdown's Formatting Syntax</h2>\n\n<p>This page offers a brief </p>\n"发布于 2013-06-23 03:54:25
插入一些换行符:
rawtext = "Getting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\nThis page offers a brief "如果短划线和文本在单独的行上,<h1>只会将短划线前的文本转换为Markdown。(否则Wow - I never knew that会将Wow转换为<h1>。)
https://stackoverflow.com/questions/17254703
复制相似问题