Syntax Highlighting makes it easier to read the semantics of
the structured content by displaying each type of code (language) in different colors and
fonts. The application provides the ability to add syntax highlights in codeblocks for DITA to
PDF or HTML-based output through the use of the @outputclass attribute and a
variety of predefined values are available.
@outputclass attribute on the
<codeblock> element and set its value to one of the predefined
language values. The Content Completion Assistant offers a list of the
possible values when adding the @outputclass attribute in
Text mode but there are also two simple ways to set the value in
Author mode:<codeblock> element in the editor
and in the Attributes view, click on the
Value cell for the @outputclass attribute and
select one of the predefined values (for example, language-xml).<codeblock> element in the editor
and use the Alt +
Enter keyboard shortcut to open the in-place attributes editor
window. Then select one of the predefined values from the Value
drop-down menu.@outputclass attribute, as it may
lead to improper highlighting.language- prefix.Example:
@outputclass set as
language-css:<codeblock outputclass="language-css" id="codeblock_1">@page preface-page {
background-color:silver;
@top-center{
content: "Custom Preface Header";
}
}
*[class ~= "topic/topic"][@topicrefclass ~= "bookmap/preface"] {
page: preface-page;
}</codeblock>would like this in WebHelp output:
@page preface-page {
background-color:silver;
@top-center{
content: "Custom Preface Header";
}
}
*[class ~= "topic/topic"][@topicrefclass ~= "bookmap/preface"] {
page: preface-page;
}