Adding tabs in output using AsciidoctorJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding tabs in output using AsciidoctorJ

sean.osterberg
I'm trying to figure out the best way to wrap sections of AsciiDoc text in tabs upon conversion to HTML. I've looked at the AsciidoctorJ API pretty extensively and it seems like one viable (yet not super clean) way is to mark the section with a style or ID and then use Jsoup in a post-processor to inject the tab HTML myself.

For example, if I want two tabs with code blocks in my output, I could do something like this:

= Tab example

[role=tab-XML]

XML content goes here

[role=tab-JSON]

JSON content goes here

Afterwards I add and register a post-processor that uses Jsoup to take the contents of those styled divs and do with them what I want.

Any thoughts?