Click or drag to resize
Sandcastle Help File BuilderSyntax Highlighting <pre> Tag Content

The help file builder allows you to add custom attributes to the <pre> tags in additional content HTML pages to specify how the text should be colorized. The same attributes defined for the code block component can be used on <pre> tags with the exception of the source and region attributes. For the remaining attributes, the lang attribute must appear or they will be ignored. If the keepSeeTags attribute is used, be aware that additional content files can only resolve links to help file topics, not online MSDN content. See the Code Block Component help topic for details. Below is an example.

Caution note Caution

Deprecated

The additional content model of adding extra content to a help file has been deprecated. While it will continue to be supported and will not be removed, it will not receive any more features or updates. Going forward, conceptual content is the preferred method of adding non-reference content to the help file. The additional content feature can still be used to override stock content and add supporting files to the help file.

As specified in the HTML
<pre lang="cs" numberLines="true" outlining="true"
  title="Example of Syntax Highlighting">
#region Collapsible region
// Test method
public void TestMethod(string s, int x)
{
#if DEBUG
    // Debug code
    x = x + 1;
    s = x.ToString();
#else
    // Release code
    x = x + 5;
    s = x.ToString();
#endif

    Console.WriteLine("The string = " + s);
}
#endregion
</pre>

As rendered with colorizing and collapsible regions:

Example of Syntax Highlighting
 1-#region Collapsible region
 2 // Test method
 3 public void TestMethod(string s, int x)
 4 {
 5 #if DEBUG
 6-    // Debug code
 7     x = x + 1;
 8     s = x.ToString();
 9 #else
10-    // Release code
11     x = x + 5;
12     s = x.ToString();
13 #endif
14 
15     Console.WriteLine("The string = " + s);
16 }
17 #endregion
See Also