I would like to highlight some of my code in tables. I tried many ways but I could get it fixed.
I would appreciate if someone can help me.
I would like to highlight some of my code in tables. I tried many ways but I could get it fixed.
I would appreciate if someone can help me.
great question!
Most AsciiDoc syntax is not rendered inside a table, only basic syntax like *bold*
.
You have to explicitly tell Asciidoctor to render the whole feature set.
There are two ways to do so:
1) prepend the character a
to the |
of the cell where you want Asciidoctor to render the full syntax
2) configure a whole column to be rendered as AsciiDoc by stating your wish in front of the table: [cols="a,a"]
will render a AsciiDoc in both columns of a two column table.
here is a gist to demonstrate this: https://gist.github.com/rdmueller/b79f4b00890f75644a0186c4adda589a
docs can be found here: https://asciidoctor.org/docs/user-manual/#cols-format
Examples:
|====
|Col1 | Col2
| even complex formattings like source code highlighting works this way
a|
[source, groovy]
----
5.times {
println it
}
----
|====
[cols="a,a"]
|====
|Col1 | Col2
| even complex formattings like source code highlighting works this way
|
[source, groovy]
----
5.times {
println it
}
----
|====
See the gist for a rendering of these examples
© 2022 - 2024 — McMap. All rights reserved.