Syntax Highlighting in PDF and Webhelp Output

Here should go questions about transforming XML with XSLT and FOP.
dgallo
Posts: 90
Joined: Tue Mar 31, 2015 10:43 pm

Syntax Highlighting in PDF and Webhelp Output

Post by dgallo »

When we have code inside the programming elements such as codeblock, codeph, pre, etc. we would like to use syntax highlighting for the different languages. Is this possible in Oxygen 17.1? One language we specifically need syntax highlighting for is .lua. Is this also supported?

Thanks,
Danielle
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by Radu »

Hi Danielle,

If you open the DITA topic in Oxygen and you set the caret inside the codeblock, in the Attributes view you can try to edit its @outputclass attribute. It should allow you to set various languages, all of them supported for syntax highlight both in the PDF and in the XHTML output. You can set its outputclass value to language-lua, from what I tested, although we do not show it as a possible value it works.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dgallo
Posts: 90
Joined: Tue Mar 31, 2015 10:43 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by dgallo »

This is great. Is there a way to add additional language libraries to the DITA-OT? If so, do you have an idea where that might be?

Thanks,
Danielle
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by Radu »

Hi Danielle,

The DITA OT plugin which does the highlighting can be found in:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\com.oxygenxml.highlight

There is also a "highlighers" folder which contains XML configuration files for each highlighter. So you could try to explore adding a new highlighter, I'm not very familiar with the syntax for such configuration files.
The plugin is based on the XSLTHL project:

http://sourceforge.net/projects/xslthl/

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
maglid
Posts: 75
Joined: Mon Sep 28, 2009 8:10 am

Re: Syntax Highlighting in PDF and Webhelp Output

Post by maglid »

Do you sell this plugin? I need to run it on a server, not from Oxygen.

Thanks,
Mark
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by Radu »

Hi Mark,

For now the highlight plugin is not sold separately.
It is sold bundled with the Oxygen Webhelp plugin in a separate WebHelp bundle of plugins which can be used outside of Oxygen:

https://www.oxygenxml.com/xml_webhelp/d ... bhelp.html

So if you buy the WebHelp bundle you can also use the highlight plugin outside of Oxygen.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dmurphy
Posts: 3
Joined: Mon Apr 24, 2017 11:05 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by dmurphy »

I am currently evaluating Oxygen 16.1 and am very interested in the syntax highlighting. I added the outputclass to a <codeblock>, but it has no effect on the output. (I see the highlight plugin in the plugins directory.) Is there something else I need to do? Btw, I am using the SDL LCA CMS.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by Radu »

Hi,

Are you publishing using Oxygen's integrated DITA OT or using some facility on the CMS side?
Because if you publish on the CMS side, you would probably need to install and use the DITA OT plugin mentioned in this thread also in the DITA OT located on the CMS side.
Otherwise if you are publishing using Oxygen's integrated DITA OT distribution this should work. So you added "outputclass='language-xml'" on the codeblock, right?
Have you tried creating a sample DITA map and a topic on the local hard drive and publish? Does that work better than publishing from the CMS?

Officially Oxygen 16 is in our end of support stage so we no longer officially offer tech support for it:

https://www.oxygenxml.com/eol.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dmurphy
Posts: 3
Joined: Mon Apr 24, 2017 11:05 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by dmurphy »

Hi Radu,

Thanks for the quick reply. Yes, we are using the DITA OT on the CMS side. We are actually currently using XMetaL, but looking into switching to Oxygen. Unfortunately, the version of the CMS we are using only supports version 16.1 of Oxygen. Maybe we better rethink the switch until after we upgrade our CMS. I don't want to move to an unsupported version of Oxygen. I guess I'll have to hold off pursuing syntax highlighting until then. Thanks for your help.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by Radu »

Hi,

The SDL 2016 CMS should support Oxygen 17.1 which is newer than 16, although the latest Oxygen version is 19.0 and 17.1 is about 2 years older than 19.0.
Have you tried my suggestion of trying to publish a local map and topic using Oxygen's DITA OT just to see if the syntax highlight in codeblocks marked with @outputclass works better that way?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dmurphy
Posts: 3
Joined: Mon Apr 24, 2017 11:05 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by dmurphy »

Hi Radu,

Yes, I was able to publish from a local map and topic and see the syntax highlighting in the generated PDF. That works great. But we need to figure out what we are going to do in terms of SDL version and Oxygen. Thanks for your help.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Syntax Highlighting in PDF and Webhelp Output

Post by Radu »

Hi,

Maybe next experiment for you would be to try having the same small map and topic committed to the SDL server, open the map from there in the Oxygen DITA Maps Manager and publish using the same transformation scenario, see if that works or not...
If that does not work, if you edit the transformation scenario you are using, in the Output tab you have the option to show the console output. Then after publishing you should have a "DITA OT" console view at the bottom of Oxygen containing lots of logging information. Maybe you can copy that logging info and paste it in a code block on the thread, I could try to take a look at it...

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