How to modify the keywords list?

Aug 29, 2012 at 1:32 AM

Hello, I'd like to alter the color of some custom types in my code examples. I understand that to do this I have to add them to a keywords list (and then presumably change a property or something) but I can't figure out how to do this using the Help File Builder GUI. Can someone post some instructions please? Thanks you very much in advance.

-L

Coordinator
Aug 29, 2012 at 4:00 PM

I assume you mean the syntax coloring in <code> elements.  If so, that's controlled by the Colorizer\highlight.* files in the SHFB installation folder.  The XML file controls the languages and keywords.  The CSS file controls the color of the highlighted keywords.  You can modify them directly to suit your needs but there are no provisions to customize the highlighting on a project by project basis.

Eric

 

Aug 30, 2012 at 4:39 PM

Sorry Eric, my initial question wasn't properly worded. What I actually need to do is change the color of the class names in my example code blocks. Is this possible?

-L

Coordinator
Aug 30, 2012 at 8:36 PM

The same information applies.  The code colorizer used by the build component is keyword/pattern based so it won't recognize user types and members without some help.  What you really need is something that parses the actual syntax of the code like Visual Studio.  If you can find a code colorizer that will do what you need, the build component could probably be adapted to use it instead.

Eric

 

Aug 30, 2012 at 9:57 PM

Thanks for the reply Eric. You say the colorizer won't recognize user types without "some help". How do I help it? Can I alter the CSS/XML files to contain an additional list of types to look for and color? I could just add these types to one of the keywords lists but then the color would be the same as all the other keywords (blue), whereas object types are usually colored a teal color in Visual Studio.

-L

Aug 30, 2012 at 10:13 PM

Alternatively, is there a color tag I can use within the <code></code> block to color the class names manually?

-L

Coordinator
Sep 3, 2012 at 6:21 PM

As I recall, if you want them highlighted in a different color, you'd have to create your own keyword set and add a new rule to each language to handle them.  The rule would specify the class name from the CSS file to use for the keyword set.  See the existing <keyword> elements in the language rules for an example.

Eric