gpt4 book ai didi

html - 如何格式化 Multimarkdown 表格?

转载 作者:太空狗 更新时间:2023-10-29 15:39:16 24 4
gpt4 key购买 nike

我正在按照 syntax guide 中表格部分下的指南编写 Multimarkdown 表格。 ,我希望使用 Text::MultiMarkdown 将它们转换为 HTML .

效果很好,唯一的问题是我不知道如何控制表格的格式(显示边框、对齐标题、字体大小等)。

最佳答案

它是 HTML,因此您需要在 CSS 中进行额外的格式化(wikipedia entry)。

制作MultiMarkdown使用 CSS 文件,您需要将必要的元数据添加到文档中。来自Text::MultiMarkDown文档:

MultiMarkdown supports the concept of 'metadata', which allows you to specify a number of formatting options within the document itself. Metadata should be placed in the top few lines of a file, on value per line as colon separated key/value pairs. The metadata should be separated from the document with a blank line.

例如:

use Text::MultiMarkdown 'markdown';

my $text = <<EOL;
css: table.css

| | Grouping ||
First Header | Second Header | Third Header |
------------ | :-----------: | -----------: |
Content | *Long Cell* ||
Content | **Cell** | Cell |

New section | More | Data |
And more | And more |
[Prototype table]
EOL

my $html = markdown( $text, {document_format => 'Complete'} );

注意。请参阅 css: table.css 行。

所以上面的 $html 现在将包含指向 table.css 的必要样式表链接。您只需在 table.css 中定义 CSS 即可满足您的格式要求。例如:

caption { font-size: 200%;}
table { border: 1px solid black; }
td,th { border: 1px solid black; }
th { width: 120px; }

关于html - 如何格式化 Multimarkdown 表格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4058761/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com