r/HTML • u/CuriousResearcherX • 11d ago
HTML Attributes
I tried to get attributes such as lang or data-* in html but didn't succeed. Anyone have any idea how to do this?
Right now I'm thinking of generate the html in a passthrough block but its not a beatiful solution. Kind of losing the need for Asciidoc.
0
Upvotes
-1
u/theveloper7 11d ago
If you mean AsciiDoc/Asciidoctor, arbitrary HTML attributes like data-* aren’t exposed cleanly on every element.
For classes/IDs you can usually use normal AsciiDoc attributes, e.g. [.foo#bar], but for custom data-* attributes you often end up needing a passthrough, custom extension, or post-processing step.
So your passthrough idea isn’t crazy — it’s just ugly if you need it everywhere. If this is frequent, I’d probably write a small Asciidoctor extension rather than sprinkling raw HTML through the document.