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.
1 Answer
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:
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
2