Adding Syntax Highlights for Codeblocks
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 14
- Joined: Tue Aug 08, 2023 2:43 am
Adding Syntax Highlights for Codeblocks
Post by kate_lopresti »
I'm testing syntax highlights for codeblocks using predefined @outputclass attribute values:
However, using the DITA HTML5 and DITA XHTML transformation scenarios, the output is black and white. Is there something I need to add to the scenario?
Code: Select all
<codeblock id="codeblock_xpj_fjj_42c" outputclass="language-python">
# This program prints Hello, world!
print('Hello, world!')
</codeblock>
test_html5.png
test_xhtml.png
https://www.oxygenxml.com/doc/versions/ ... cks-x.htmlYou do not have the required permissions to view the files attached to this post.
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Adding Syntax Highlights for Codeblocks
Post by julien_lacour »
Hello,
Syntax higtlight is available for both HTML5 and XHTML outputs, as you can see below:
Make sure Oxygen > Options > Preferences... > DITA > DITA Open Toolkit is set to "Built-in Oxygen Publishing Engine (based on DITA-OT 4.x)" and not a custom DITA-OT.
The emphasized elements are given by a custom Oxygen plugin not available on vanilla DITA-OT versions.
The highlight colors are given by the com.oxygenxml.webhelp.responsive/src/main/app/topic/syntax-highlight.css stylesheet contained in the WebHelp Responsive plugin. You can copy it and refer it in your HTML transformation(s) using args.css parameter (make sure to also enable args.copycss in order to copy the stylesheet into the output directory).
Regards,
Julien
Syntax higtlight is available for both HTML5 and XHTML outputs, as you can see below:
image.png
(tested using <oXygen/> XML Editor 27.0, build 2024121306)Make sure Oxygen > Options > Preferences... > DITA > DITA Open Toolkit is set to "Built-in Oxygen Publishing Engine (based on DITA-OT 4.x)" and not a custom DITA-OT.
The emphasized elements are given by a custom Oxygen plugin not available on vanilla DITA-OT versions.
The highlight colors are given by the com.oxygenxml.webhelp.responsive/src/main/app/topic/syntax-highlight.css stylesheet contained in the WebHelp Responsive plugin. You can copy it and refer it in your HTML transformation(s) using args.css parameter (make sure to also enable args.copycss in order to copy the stylesheet into the output directory).
Regards,
Julien
You do not have the required permissions to view the files attached to this post.
-
- Posts: 14
- Joined: Tue Aug 08, 2023 2:43 am
Re: Adding Syntax Highlights for Codeblocks
Post by kate_lopresti »
Sure enough, I was pointing to a custom DITA-OT. Thanks for the correction.
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service