可以将特定的类添加到 asciidoc 中的表中,如下所示:
ASCIIDOC
[.custom]
[cols="40a,80a",options="header"]
|===
|First Name
|Family Name
|John
|Smith
|==
HTML(在 Antora 运行之后)
<table class="tableblock frame-all grid-all stretch custom">
..
..
<thead>
<tr>
<th class="tableblock halign-left valign-top"><strong>First Name</strong></th>
<th class="tableblock halign-left valign-top"><strong>Family Name</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"><p>John</div></div></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"><p>Smith</p></div></div></td>
</tr>
因此,“自定义”的“角色”已应用于 <table> 元素。但是,我还想为 <th>、<tr> 和 <td> 元素指定特定属性。我该怎么做呢 ?
我尝试过:
|[.custom]First Name
对于第一个元素,并且:
|[.custom]John
对于 td 元素
但这只会在转换为 html 时给我以下信息:
<th class="tableblock halign-left valign-top"><strong class="custom">First Name</strong>
</th>
..
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"><p>[.custom]John</p></div></div></td>
我如何实现以下目标:
<th class="tableblock halign-left valign-top custom"><strong>First Name</strong></th>
和
<tr class="tableblock halign-left valign-top custom"><div class="content"><div class="paragraph"><p>John</p></div></div></td>