How to fix syntax highlighting in examples

90 views Asked by At

I have noticed that in my DocFX output the syntax highlighting is not correct for the examples, meaning example code inside <example><code>...</code></example> doc comments, even though the API signatures are highlighted correctly. It seems that the issue is due to the following difference in the HTML output:

For API signatures, html has something like this: <pre><code class="lang-csharp hljs">public void foo()</code></pre>.

But in the examples it is: <pre><code>.....</pre><code>.

The difference is that class attribute in the code tag is absent.

When i manually add class="lang-csharp hljs" into the code tags into the html output of the examples, this fixes the syntax highlighting.

The question is: how can I make DocFX generate correct html output for the examples (with class="lang-csharp hljs" present in code tags)?

0

There are 0 answers