pandoc 在 markdown 中添加 class 到 table

pandoc add class to table in markdown

对于标题,对于code-block,对于跨度元素,我们可以使用pandoc添加{.class}来添加class。

# Heading 1 {.my_class_for_heading1}

Here is some `code`{.my_class_for_code} and 
for a [span]{.my_class_for_span} it is working as well
and for img and url it is available as well
for [pandoc](http://www.pandoc.org/){.my_class_for_url}

我正在使用 bootstrap,最好将 "table" and/or "table-hover" 指定为 class 这样 html 视图得到 table 装饰 bootstrap CSS.

有人吗?

在 pandoc 的内部文档 AST 中,tables 自 pandoc 2.10 以来具有属性,但 markdown reader hasn't been updated for that yet. (Same for other formats.)

但是,您可以:

  • 用 class 将 table 包装在原始 HTML div 中(这不适用于 bootstrap CSS期望 class 在 table),
  • 写一个pandoc filter,或者
  • 可能在这种情况下更容易:post-process 输出 HTML 添加一个 class.