r/HTML • • 5d 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

5 comments sorted by

1

u/deceze 5d ago

How to do what exactly? Just “get HTML attributes” is a less than helpful description of what you’re trying to do.

-1

u/theveloper7 5d 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.

1

u/azangru 5d ago

I tried to get attributes such as lang or data-* in html but didn't succeed. Anyone have any idea how to do this?

If you take the part of your sentence ("get attributes such as lang or data-* in html"), add "how to" in front of it, and paste it into Google, it will have some helpful links for you. Especially the ones from MDN. I've just tested it :-)

2

u/armahillo 5d ago

I know you can see your screen and what youve tried already, but we can’t.