1

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)?

Yevgeniy P
  • 1,480
  • 1
  • 15
  • 23
  • Did you check the project's github issue tracker for this? I'd consider this a bug (if not configurable somehow) and either file it as such or if I can fix it post a pull request with the fix. – Fildor Jul 15 '23 at 06:18
  • I've never used DocFX (I'm an author of similar VSdocman), so just a blind guess. The tag has an unofficial optional attribute 'lang'. It's been used for years by various documentation tools. See https://www.helixoft.com/files/vsdocman/help/acodexml.html. You can try to see if it helps. – Peter Macej Jul 15 '23 at 06:51
  • I think OP was expecting DocFX to include the language attribute @PeterMacej – Fildor Jul 15 '23 at 07:48
  • @PeterMacej thanks, i tried lang attribute with several possible values, but unfortunately no change in the generated html. – Yevgeniy P Jul 15 '23 at 10:59
  • 1
    @Fildor-standswithMods I agree this looks like a bug, at least there should be documented attribute to specify language. – Yevgeniy P Jul 15 '23 at 11:08

0 Answers0