Customize Syntax Highlighting colors

Questions about XML that are not covered by the other forums should go here.
Posts: 12
Joined: Thu Feb 11, 2021 9:22 pm

Customize Syntax Highlighting colors

Post by daryl » Fri Feb 19, 2021 9:09 pm


Is it possible to customize syntax highlight colors in a codeblock in a Webhelp Responsive Output?


Posts: 740
Joined: Mon Dec 05, 2011 6:04 pm

Re: Customize Syntax Highlighting colors

Post by Costin » Wed Feb 24, 2021 1:33 pm

Hi Daryl,

There is predefined support for syntax-highlight for codeblocks, so, depending on the value of the outputclass attribute set for each specific codeblock to specify the code/languaget, the corresponding syntax-higlight coloring scheme would be applied over the codeblock's content. You can find more details in the Adding Syntax Highlights for Codeblocks in the Output section from the Oxygen XML Editor User-Guide.
This applies also for WebHelp, so I've just asked our documentation team to include that topic also in the WebHelp Responsive User-Guide.

However, there is no out-of-the-box support for customizing the syntax highlight colors.
You could most probably customize the colors using your own CSS customization.
You can find more details on how to use the internet browser's CSS inspector to identify the specific elements which your CSS rules could match and how to customize your output using CSS in this section from the WebHelp Responsive user-guide.

For an example of setting syntax-highlight colors through CSS, you should take a look at the the "syntax-highlight.css" predefined CSS, available in: [DITA_OT_DIR]/plugins/com.oxygenxml.webhelp.responsive/oxygen-webhelp/app/topic/syntax-highlight.css

Costin Sandoi
oXygen XML Editor and Author Support

Post Reply