Code examples in tabs
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 118
- Joined: Wed Mar 17, 2010 1:04 pm
Code examples in tabs
I am working on a REST API documentation. It should include code examples in both curl and Java. I want to present these examples in tabs, and I have installed the com.oxygenxml.wh.tabs plugin from the blog for this purpose. The result initially appears as expected, but I can only view the first example. When I click on the second tab, it is not activated. This applies to my customized output and the default WebHelp. Can anybody help me with that?
-
- Posts: 58
- Joined: Thu Mar 05, 2009 11:44 am
Re: Code examples in tabs
Hello,
Starting with version 27 of Oxygen you can achieve this without installing an additional plugin.
To present code examples (such as curl and Java) in tabs within your REST API documentation, you can use the @outputclass="wh-tabbed" attribute on certain elements. This will render the content as tabs in the WebHelp output.
For example, you can use an unordered list (<ul>) and assign the wh-tabbed output class. Each list item will become a tab, and the tab name will be taken from the first <ph> (phrase) element inside each item. Here’s a sample structure:
This will display two tabs: one for curl and one for Java, each showing the corresponding code example. You can use a similar approach with definition lists (<dl>) or choice tables (<choicetable>).
For more details and examples, see: How to Display Certain Elements as Tabs.
Best regards,
Marius
Starting with version 27 of Oxygen you can achieve this without installing an additional plugin.
To present code examples (such as curl and Java) in tabs within your REST API documentation, you can use the @outputclass="wh-tabbed" attribute on certain elements. This will render the content as tabs in the WebHelp output.
For example, you can use an unordered list (<ul>) and assign the wh-tabbed output class. Each list item will become a tab, and the tab name will be taken from the first <ph> (phrase) element inside each item. Here’s a sample structure:
Code: Select all
<ul outputclass="wh-tabbed">
<li>
<ph>curl</ph>
<pre>
curl -X GET "https://api.example.com/resource"
</pre>
</li>
<li>
<ph>Java</ph>
<pre>
HttpURLConnection con = (HttpURLConnection) new URL("https://api.example.com/resource").openConnection();
con.setRequestMethod("GET");
</pre>
</li>
</ul>
For more details and examples, see: How to Display Certain Elements as Tabs.
Best regards,
Marius
Marius Ciolacu
Syncro Soft / Oxygen XML
Syncro Soft / Oxygen XML
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service