Page 1 of 1

Write API Guide using DITA

Posted: Thu Mar 22, 2018 8:48 am
by catherine
Hi, I am trying to write an API guide using DITA. I find that API guide is quite different from other guides. We have a lot of comands, codes, and references in the guide.
Is there any guideline that I should follow when writing an API guide?

I found this page on your user guide: https://www.oxygenxml.com/dita/1.3/spec ... rence.html

I wonder how to write colorful codes in the

Code: Select all

codeblock
element. and the there is a button at the top-right cornner of the

Code: Select all

codeblock
element that users can copy the codes quickly. How to achieve this?

BTW, how did you make the title style to a grey background, or which element did you use?

Thanks for your any response.

Re: Write API Guide using DITA

Posted: Fri Mar 23, 2018 12:09 pm
by Costin
Hi catherine,
I wonder how to write colorful codes in the

Code: Select all

codeblock
For styling purposes, you can use the "outputclass" attribute on the <codeblock/> element. As the @outputclass attrobute specifies the role of an element in the output, you should choose the correct value for it. For <codeblock/> elements for example, content completion offers a number of languages (like "language-xml", "language-java", etc.) which you could use as values for the "@outputclass" attribute, so, depending on the syntax highlight you would need to have in the codeblock, you could choose the appropriate value (language).
You can find more details about the "outputclass" attribute in the DITA Style Guide for Authors.
and the there is a button at the top-right cornner of the

Code: Select all

codeblock
element that users can copy the codes quickly. How to achieve this?
The button is present by default, when code blocks are used.
BTW, how did you make the title style to a grey background, or which element did you use?
To achieve a similar styling with grey background, you could use the <codeph> element.

Regards,
Costin