How to add colored HTML snippet to Sandcastle documentation?

I am using Builder Builder Sandcastle and would like to include colored HTML snippets in Conceptual Content. Is this possible, and if so, how?

I tried <code>, <codeExample>, and <sampleCode language = "HTML" />.

The best result so far is HTML coding an HTML sample and putting it in a .snippets file, for example.

<?xml version="1.0" encoding="utf-8" ?>
<examples>
   <item id="htmlSnippet">
      <sampleCode language="HTML">
         &lt;span&gt;My Html&lt;/span&gt;
      </sampleCode>
   </item>
</examples>

Then specify it in the .aml file.

<codeReference>htmlSnippet</codeReference>

I would prefer it to be colored, but I cannot figure out how to add formatting.

+3
source share
3 answers

According to the MAML Guide, the correct way to do this is to use a tag <code>with a section CDATA:

<code language="xml" title="Example Configuration">
<![CDATA[
    <span>My Html</span>]]>
</code>

CDATA , .

+2

, , Sandcastle html xml. , , - , .

:

<?xml version="1.0" encoding="utf-8" ?>
<examples>
   <item id="htmlSnippet">
      <sampleCode language="xml"><!CDATA[[
         <span>My Html</span>
       ]]>
      </sampleCode>
   </item>
</examples>

Sandcastle Help File Builder, , , xml ... XAML, , :

<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
    assembly="{@SandcastlePath}ProductionTools\SyntaxComponents.dll">
    <filter files="{@SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
+1

SHFB , <code>.

; :

test.html

<html>
    <head>Something!</head>
    <body>
        <h1>Heading</h1>
<!-- #region myhtml -->
        <p>Paragraph</p>
        <div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
    </body>
</html>

SomethingorOther.aml

<code language="html" source="../Examples/test.html" region="myhtml" />

:

HTML Highlighting in SHFB

Note that in the preview, your sample will appear as inexperienced XML, but when you create the documentation, everything should be just fine.

+1
source

All Articles