Search code examples
c#docfx

How to stop docfx from escaping "\\" to "\" in c# xml comments?


I am creating some XML comments which contain LaTeX style matrix notation. When creating documentation using docfx the \\ character, which normally denotes a new row in the matrix, is converted to a \.

Is there any way to prevent this happening?

///<summary>
/// Blah
///</summary>
/// \f[ \left(\begin{matrix} 0 &amp; 1 &amp; 2 \\ 3 &amp; 4 &amp; 5 \end{matrix}\right) \f]
public void Method()
{

}

Output:

<p>\f[ \left(\begin{matrix} 0 &amp; 1 &amp; 2 \ 3 &amp; 4 &amp; 5 \end{matrix}\right) \f]</p>

Solution

  • To stop docfx from processing the contents of XML comments, instruct to skip markup in the metadata section of the docfx.json file:

    "metadata": [
        {
          <src etc>,
          "shouldSkipMarkup":true
        }
      ]