【问题标题】:Support extended markdown table syntax with Mkdocs使用 Mkdocs 支持扩展的 markdown 表语法
【发布时间】:2022-08-09 10:13:52
【问题描述】:

我的文档中有如下降价表:

+----------------------+----------------------------------------------+
| `code`               | *italics*                                    |
+======================+==============================================+
| `more code`          | | column 1 | column 2 | column 3 |           |
|                      | |----------|----------|----------|           |
|                      | | abcd     | efg      | hijk     |           |
|                      | | lmnop    | qrs      | tuv      |           |
|                      | | wx       | y        | z        |           |
+----------------------+----------------------------------------------+
| `even more code`     | Regular text that spans multiple lines       |
|                      | within this cell.                            |
|                      |                                              |
|                      |                                              |
+----------------------+----------------------------------------------+
| **bold**             | Regular text that spans multiple lines       |
|                      | within this cell.                            |
|                      |                                              |
|                      | **bolded text in a separate paragraph.**     |
+----------------------+----------------------------------------------+

是否有某种方式(例如使用插件)可以让 Mkdocs 将其呈现为生成的 HTML 中的表格?

上表可以根据需要重新格式化,但最终它需要支持包含任意降价的表格单元格,允许嵌套表格、跨多行的段落、斜体等。

值得注意的是,Pandoc supports this Markdown format。也许我可以连接到 Mkdoc(例如,通过制作我自己的插件)来使用 Pandoc 的语法来呈现 markdown。

我想避免编写内联 HTML。

  • 检查this list Python-Markdown(MkDocs 使用的 Markdown 解析器)的已知扩展。也许其中一个会为您提供解决方案。

标签: formatting markdown mkdocs


【解决方案1】:

感谢 Waylan 提供的链接,我找到了一个未维护的项目,它提供了我需要的东西。

我制作了a fork of the project(我打算保留它),并将其发布到PyPI

它可以使用pip install markdown-grid-tables 安装,然后通过将grid-table 添加到Markdown extensions 列表中来使用。

【讨论】:

  • 你能用简单的步骤详细说明如何安装吗?那将非常有帮助!
猜你喜欢
  • 2014-07-24
  • 1970-01-01
  • 1970-01-01
  • 2011-12-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-28
相关资源
最近更新 更多