使用CSS将HTML表格边框标记为Markdown

问题描述 投票:0回答:1

我有下面的markdown表,这是我的[['input.md' markdown文件的内容。

Col01 | Col02 ----- | ----- DataX | DataY
我将下面显示的CSS粘贴到记事本中,并将其另存为

'custom.css'

。我将此'custom.css'放在与input.md文件相同的目录中,并运行以下命令。pandoc -t html --css=custom.css -o output.html input.md
预期输出是一个表格,其中的线条显示为边框。实际输出是一个无边界的表,尽管它的对齐方式很像表。我做错了什么?

这是我的自定义CSS:

table { margin-left: auto; margin-right: auto; margin-bottom: 24px; border-spacing: 0; border-bottom: 2px solid black; border-top: 2px solid black; } table th { padding: 3px 10px; background-color: white; border-top: none; border-left: none; border-right: none; border-bottom: 1px solid black; } table td { padding: 3px 10px; border-top: none; border-left: none; border-bottom: none; border-right: none; } /* Add border for the last row of the table. */ /* (Might be of use for table footnotes, later). */ /* tr:last-child td { border-top: 2px solid black; } */
css latex markdown pandoc
1个回答
0
投票
pandoc -t html的问题是它生成不带标题的HTML文档。只需获取它生成的HTML文件并将其添加到开头:

<html> <head> <style> ...here comes your CSS file content... </style> </head> <body> ...rest of the HTML file generated by pandoc... </body> </html>

并且还要在结尾处附加上面提到的这两行(所以我们玩得很好:-))。
© www.soinside.com 2019 - 2024. All rights reserved.