Page 1 of 1
Config oXygen to display elements with a particular attribute and value in color
Posted: Thu Nov 22, 2018 9:29 am
by hymanshu
Is there a way to config oXygen to display elements with a particular attribute and value in color?
Example:
I'd like to config the editor to display all elements with the cust_attr attribute and a specific value in a color.
Display cust_attr=Yes in Green and cust_attr=No in Red.
<section cust_attr=Yes>
<ph cust_attr=No>
<li cust_attr=Yes>
Re: Config oXygen to display elements with a particular attribute and value in color
Posted: Thu Nov 22, 2018 9:39 am
by Radu
Hi,
The Oxygen "Author" visual editing mode is CSS based. So you can use CSS to set various backgrounds and foregrounds for various XML elements:
https://www.oxygenxml.com/doc/versions/ ... uthor.html
Also if the XML element tags appear in the Author visual editing mode you can set various colors to them by matching them with a CSS selector:
https://www.oxygenxml.com/doc/versions/ ... -tags.html
More about how to customize the DITA CSS:
http://blog.oxygenxml.com/2016/10/custo ... iting.html
Regards,
Radu
Re: Config oXygen to display elements with a particular attribute and value in color
Posted: Tue Nov 27, 2018 8:30 am
by hymanshu
Do you have an example of the CSS?
Re: Config oXygen to display elements with a particular attribute and value in color
Posted: Tue Nov 27, 2018 10:59 am
by Radu
Hi,
Probably something like:
Code: Select all
section[cust_attr="Yes"]{
-oxy-tags-color:white;
-oxy-tags-background-color:green;
}
will show the full tag markers for that specific element with those custom colors.
Regards,
Radu
Re: Config oXygen to display elements with a particular attribute and value in color
Posted: Thu Nov 29, 2018 8:36 am
by hymanshu
Big thanks, Radu. I can see the tags in colors now.
One last question. Do I need to define all tags that use cust_attr in the CSS file, or is there a way to make any tag that uses cust_attr in color?
Re: Config oXygen to display elements with a particular attribute and value in color
Posted: Thu Nov 29, 2018 8:42 am
by Radu
Hi,
It's plain CSS so you can use the "*" universal elements selector:
Code: Select all
*[cust_attr="Yes"]{
-oxy-tags-color:white;
-oxy-tags-background-color:green;
}
Regards,
Radu
Re: Config oXygen to display elements with a particular attribute and value in color
Posted: Thu Nov 29, 2018 8:44 am
by hymanshu
Please ignore my previous question. I used * in place of the tag and now any tag with cust_attr displays in color.