Page 1 of 1

Syntax Highlighting in PDF and Webhelp Output

Posted: Wed Feb 24, 2016 11:51 am
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

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Wed Feb 24, 2016 1:09 pm
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

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Wed Feb 24, 2016 2:07 pm
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

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Wed Feb 24, 2016 2:38 pm
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

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Tue Feb 07, 2017 5:59 am
by maglid
Do you sell this plugin? I need to run it on a server, not from Oxygen.

Thanks,
Mark

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Tue Feb 07, 2017 9:05 am
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/download_oxygenxml_webhelp.html

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

Regards,
Radu

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Mon Apr 24, 2017 11:09 pm
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.

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Mon Apr 24, 2017 11:56 pm
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

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Tue Apr 25, 2017 12:31 am
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.

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Tue Apr 25, 2017 1:07 am
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

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Tue Apr 25, 2017 11:08 pm
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.

Re: Syntax Highlighting in PDF and Webhelp Output

Posted: Tue Apr 25, 2017 11:51 pm
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