codeblock outputclass="language-c" syntax highlighting oddity

Martin Honnen
Posts: 60
Joined: Tue Aug 19, 2014 12:04 pm

codeblock outputclass="language-c" syntax highlighting oddity

Post by Martin Honnen » Thu Feb 13, 2020 4:59 pm

When I use oXygen 22 and the built-in DITA to PDF (based on XSL-FO) publishing for a sample like

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_d3q_35y_rkb">
    <title>Test</title>
    <body>
        <p>Test</p>
<codeblock outputclass="language-c">#define VALUE1 100 /* Comment */
#define VALUE2 200 /* Comment */
#define VALUE3 300 /* Comment */
#define VALUE4 400 /* Comment */
</codeblock>
<codeblock outputclass="language-javascript">const VALUE1 = 100; /* Comment */
const VALUE2 = 200; /* Comment */
const VALUE3 = 300; /* Comment */
const VALUE4 = 400; /* Comment */
</codeblock>
    </body>
</topic>
then all four lines in the language-javascript section have the same syntax colouring but for the language-c lines the first line use a black text color for the #define and green for the comment while the remaining three lines have all text in pink.

Radu
Posts: 6704
Joined: Fri Jul 09, 2004 5:18 pm

Re: codeblock outputclass="language-c" syntax highlighting oddity

Post by Radu » Mon Feb 17, 2020 4:07 pm

Hi Martin,

Sorry for the delay, I can reproduce the problem and added an internal issue to try and fix it.
When we have a fix I will update this thread.
Maybe as a workaround there is another highlighting plugin for the DITA OT:

https://prismjsdita-ot.readthedocs.io/en/latest/

but it will work only in the HTML-based outputs and if there is a network connection. You would probably also need to uninstall our "com.oxygenxml.highlight" DITA OT plugin.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply