Printing the id of a block
Posted by Daniel K on Apr 22, 2020; 11:46am
URL: https://discuss.asciidoctor.org/Printing-the-id-of-a-block-tp7943.html
Hi all,
we are using blocks with ids as follows:
[#blockid,role="highlightedblock"]
:myattribute: myvalue
--
Text in block
{myattribute}
--
It is possible to print out the value of a defined attribute.
Is it somehow possible to print the id of the current block itself?
The Id shall be shown in the HTML and PDF output.
For HTML, we currently using a workaround with CSS:
.highlightedblock::before {content: "[" attr(id) "]"; margin-right: 1em; font-weight: bold}
This is not a very nice solution since it does not work with the PDF output. Moreover, in HTML it is not part of the DOM tree.
Does somebody see any solution to solve this issue?
Thanks!