Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Markdown 将ID或类添加到标记元素_Markdown_Multimarkdown - Fatal编程技术网

Markdown 将ID或类添加到标记元素

Markdown 将ID或类添加到标记元素,markdown,multimarkdown,Markdown,Multimarkdown,是否可以向(多)标记元素添加id或类 例如表格、段落或代码块 我想用css设计一个表格,但不包括以下工作: [captionid][This is the caption, not the table id] | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | |第一个

是否可以向(多)标记元素添加id或类

例如表格、段落或代码块

我想用css设计一个表格,但不包括以下工作:

[captionid][This is the caption, not the table id]
| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |




|第一个收割台|第二个收割台|
| ------------- | ------------- |
|内容单元|内容单元|
|内容单元|内容单元|
在网上找不到其他任何东西


我不是指github或stackoverflow风味的降价。顺便说一句。

我可以确认这一点。狩猎快乐

降价

{:.foo}
| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |
css

.foo{
背景:蓝色;
}

经过一些研究,我想出了一个简单而直接的解决方案:)

我将表放在两个HTML占位符之间,并使用jQuery对这些占位符进行微调,仅根据需要进行微调:

表的开头 jQuery:通过添加类来微调表

(功能(){
$('div.tables-begin').nextUntil('div.tables-end','table').addClass('table-bordered');
})();

您可以将自定义类或id添加到元素中,方法是将类或id放在元素后面的花括号中,如下所示:
{id.class}

例如:

[Read more](http://www.stackoverflow.com "read more"){#link-sf .btn-read-more}
将呈现如下所示:


出于CSS的目的,您可以参考

,您可以在前面的元素中添加一个id,然后使用选择器来更改下面的元素

这样降价:

<div class="special_table"></div>

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |
div.special_table + table tr:nth-child(even) {background: #922}

直到我看到你的答案,我才知道克拉姆敦有这个功能-谢谢!kramdown支持MathJax和表吗?只需用div:)包装markdown表即可?然后是.foo表{color:red;}-为什么使用javascript?好的一点@BadrHari,但问题清楚地问到如何向markdown元素添加“Class”或“Id;”)它应该是$('div.tables-start'),而不是$('div.tables-begin')@BadrHari-在mkdocs材料下尝试过,作为一种副作用,所附的标记没有翻译成html。
<div class="tables-start"></div>
<div class="tables-end"></div>
<script type="text/javascript">
(function() {
    $('div.tables-begin').nextUntil('div.tables-end', 'table').addClass('table table-bordered');
})();
</script>
[Read more](http://www.stackoverflow.com "read more"){#link-sf .btn-read-more}
<div class="special_table"></div>

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |
div.special_table + table tr:nth-child(even) {background: #922}