This project has moved. For the latest updates, please go here.

Custom Code highlighter for Code brackets

Apr 18, 2014 at 7:10 PM
Edited Apr 18, 2014 at 7:12 PM
I've just started using sandcastle to build a help file for one of my projects.

Is there a way to create a custom Language for the code block?
* Comment
(0:0) when something happens,
   (1:0) and something happens,
(0:1) Or this Happens,
   (1:1) and %Variable is equal to 5,
         (5:0) tell everyone {it happens!!}
          (5:1) let it rain.
The Language I'm using is called Monkey Speak. I want to be able to highlight the (#:#) as one color, the %Variable as another Color... Numbers and the "#" tag as another color and any thing in Curly Brackets "{ }" is a string and Those can contain %Variable. Comments start with an Astrik "*"

If Possible I'd like to indent depending on which trigger it is

How can I do this with sandcastle?
Apr 18, 2014 at 7:25 PM
Edited Apr 18, 2014 at 7:27 PM
The code colorization is handled by the Code Block Component. It uses a colorizer with a set of languages and rules defined in the highlight.xml file found in the %ProgramFiles(x86)%\EWSoftware\Sandcastle Help File Builder\Colorizer folder to determine how the code is colorized. The file contains sections that define the language names, the keywords, and the regular expressions used to parse the code to determine how the parts are colorized. The colorizer will not format or indent code beyond normalizing the leading whitespace and tab size. The code is laid out and indented exactly as it appears in the comments.

By adding the code block component to the project using the Component Configurations property page, you can override the rules file it uses in its configuration. That will allow you to create a custom rules file stored with the project so that you don't have to modify the default one installed with the tools.

Apr 18, 2014 at 10:30 PM
Exactly what I needed to get started.. Thanks!
Sandcastle picked up another user!