How to set different highlighting colours for common syntax type according to coding language
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 8
- Joined: Fri Apr 21, 2023 12:57 pm
How to set different highlighting colours for common syntax type according to coding language
Hi,
How can I set different colours for the same highlighter type (eg “keywords”) according to each different coding language via css and share these setting with other team members on the remote server/in the project
Thanks in advance and best regards,
Olivier
How can I set different colours for the same highlighter type (eg “keywords”) according to each different coding language via css and share these setting with other team members on the remote server/in the project
Thanks in advance and best regards,
Olivier
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to set different highlighting colours for common syntax type according to coding language
Hi Olivier,
Let's try to build a small example, a DITA topic with a codeblock of type "Java" which has a keyword inside it:
We publish this to WebHelp and look at the generated HTML content for the topic, it looks like this:
So the DITA codeblock became an HTML <pre> element with a @class attribute value which contains 'language-java' and which contains inside it the <strong class="hl-keyword">.
Then with a CSS selector in your CSS customization layer you could do something like:
So in general you can use the web browser inspector tools to look at the generated HTML output structure and build CSS selectors to change it in various ways.
Regards,
Radu
Let's try to build a small example, a DITA topic with a codeblock of type "Java" which has a keyword inside it:
Code: Select all
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="introduction">
<title>Introduction</title>
<body>
<p>
<codeblock outputclass="language-java">import abc;</codeblock>
</p>
</body>
</topic>
Code: Select all
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-java" id="introduction__codeblock_akf_vxm_f1c" data-ofbid="introduction__codeblock_akf_vxm_f1c"><strong class="hl-keyword">import</strong> abc;</pre>
Then with a CSS selector in your CSS customization layer you could do something like:
Code: Select all
pre.language-java .hl-keyword {
color: red;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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