I'm writing Multimarkdown tables following the guidelines under the Table section in the syntax guide, and I wish to convert them to HTML using Text::MultiMarkdown .
我正在按照语法指南中表格部分的指导原则编写Multimarkdown表,我希望使用Text:: Multimarkdown将它们转换为HTML。
It works great, The only problem is I can't figure out how to control the formatting of the tables (show borders, align headers, font size etc).
它工作得很好,唯一的问题是我不知道如何控制表格的格式(显示边框、对齐标题、字体大小等)。
1 个解决方案
#1
9
It's HTML so you will need to do the extra formatting in CSS
(wikipedia entry).
它是HTML,所以你需要在CSS(*条目)中做额外的格式化。
To make MultiMarkdown use a CSS file you will need to add the necessary metadata to the document. From the Text::MultiMarkDown
docs:
要使MultiMarkdown使用CSS文件,您需要向文档添加必要的元数据。从文本中::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.
MultiMarkdown支持“元数据”的概念,它允许您在文档本身中指定许多格式选项。元数据应该放在文件的前几行中,每行的值作为冒号分隔的键/值对。元数据应该用空行从文档中分离出来。
For eg:
如:
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'} );
NB. see the line css: table.css
.
NB。参见css: table.css。
So $html
in above will now contain the necessary stylesheet link to table.css
. You just need to define the CSS in table.css
to meet your formatting requirements. For eg:
因此上面的$html现在将包含到table.css的必要样式表链接。只需在表中定义CSS即可。css以满足您的格式要求。如:
caption { font-size: 200%;}
table { border: 1px solid black; }
td,th { border: 1px solid black; }
th { width: 120px; }
#1
9
It's HTML so you will need to do the extra formatting in CSS
(wikipedia entry).
它是HTML,所以你需要在CSS(*条目)中做额外的格式化。
To make MultiMarkdown use a CSS file you will need to add the necessary metadata to the document. From the Text::MultiMarkDown
docs:
要使MultiMarkdown使用CSS文件,您需要向文档添加必要的元数据。从文本中::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.
MultiMarkdown支持“元数据”的概念,它允许您在文档本身中指定许多格式选项。元数据应该放在文件的前几行中,每行的值作为冒号分隔的键/值对。元数据应该用空行从文档中分离出来。
For eg:
如:
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'} );
NB. see the line css: table.css
.
NB。参见css: table.css。
So $html
in above will now contain the necessary stylesheet link to table.css
. You just need to define the CSS in table.css
to meet your formatting requirements. For eg:
因此上面的$html现在将包含到table.css的必要样式表链接。只需在表中定义CSS即可。css以满足您的格式要求。如:
caption { font-size: 200%;}
table { border: 1px solid black; }
td,th { border: 1px solid black; }
th { width: 120px; }