【发布时间】:2021-05-23 10:08:06
【问题描述】:
我正在尝试(以编程方式)使用markdown2 将 Markdown 表转换为 HTML,但它不起作用。我认为应该是因为 markdown2 应该是一个
Markdown 在 Python 中的完整实现
一个最小的非工作示例(旨在在 Jupyter 笔记本中运行以正确显示输出):
import markdown2
import IPython.display
markdown_text = '''
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | 1600 |
| col 2 is | centered | 12 |
| zebra stripes | are neat | 1 |
'''
display(IPython.display.Markdown(markdown_text))
converter = markdown2.Markdown()
html = converter.convert(markdown_text)
display(IPython.display.HTML(html))
有什么线索吗?
【问题讨论】: