cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

how to highlight the code in codeblock and codeph tags according with a language?

aandronova
1-Newbie

how to highlight the code in codeblock and codeph tags according with a language?

We have tried to insert the code with tags codeblock and codeph with highlights like it shown in any code editor according with used language, but it looks like plain text in PDF. What should we do to highlight the code in PDF file? Also we couldn't insert the code like a file with coderef tag, the PDF doc shows nothing, and Editor just doesn't find the file with code, but it's there.

1 REPLY 1

Hi Angela--

The highlighting you see in a code editor is added by the code editor software. It is not embedded anywhere in the code itself, so when you insert the code text into Arbortext Editor, it doesn't carry over the code editor's formatting.

You could use Font touchup tags to do your own formatting of code samples, but that would have to be done manually, which would be quite tedious. If you have access to an Arbortext developer, theoretically you could have them develop custom code to add syntax highlighting to code samples. But that would be a lot of work.

Ultimately, your most direct method for including syntax-highlighted code samples may be to load the code into your preferred code editor, take a screenshot, and insert the screenshot as a normal graphic in Arbortext. Then you'll have syntax highlighting, but you won't be able to search for code text in the PDF since it's a picture rather than actual text, so you'll have to decide if that's worth it.

As for <coderef>, I played with it a little bit, and it seems to be broken, at least in the version I am using (7.0 M050). I would file a support case with PTC for guidance on how to get <coderef> working.

--Clay

Top Tags