How to create inline macro producing HTML? (In AsciidoctorJ)
Posted by
holyjak on
URL: https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-tp8313.html
Hello!
Inspired by
https://github.com/asciidoctor/asciidoctor/issues/252#issuecomment-503605857, instead of writing manually
```
We are pass:["<abbr title='Best Friends Forever'\>BFF</abbr>"]!
```
I want to create a macro that enables me to write
```
We are abbr:BFF["Best Friends Forever"]!
```
However I am not able to find out how to create content that is passed as-is to the HTML generator. I could not find any in-depth documentation about macros and I know only very little Ruby so understanding how it is working is a challenge.
I guess I need to create a "phrase node", but of what type and with what attributes and options? If I read
https://github.com/asciidoctor/asciidoctor/blob/v2.0.10/lib/asciidoctor/converter/html5.rb#L50 correctly then the supported "context" of nodes are quoted, anchor, break, button, callout, footnote, image, indexterm, kbd, menu. None of them seems to fit here and I have no idea how to pass raw html to them.
I have tried
```java
createPhraseNode(parent, "pass", "<abbr title=\"" + attributes.get("1") + "\">" + target + "</abbr>"))
```
but it fails because there is no `convert_inline_pass`.
Help and documentation pointers most appreciated!
Cheers, Jakub