Skip to content

Conversation

@camdrit
Copy link
Contributor

@camdrit camdrit commented Apr 3, 2025

It has been some time since this repository has been active, so I apologize if this PR is unwanted, but the tool is still highly useful for myself.

The <code> tag in XML comments supports a language attribute to specify the language of the code in the block. DocFx's XML parser will pick this up and use it to produce the correct HTML markup.

Ex:

/// <code language="html"><![CDATA[
/// <span style="color: #F8F8F2;">Hello, world!</span>
/// ]]></code>

Produces:

<pre><code class="lang-html">&lt;span style="color: #F8F8F2;"&gt;Hello, world! &lt;/span&gt;</code></pre>

This PR corrects the behavior of DocFxMarkdownGen to match code blocks and not assume csharp for the lang.

Currently, DocFX doesn't properly handle replacing HTML entities with their raw character counterparts in code blocks (at least not in the metadata step) and Docusaurus will not fix this automatically inside code blocks. I think that it would be nice for dfmg to provide an option to replace HTML entities in codeblocks with their literal representations, but I think that deserves its own PR.

@Jan0660
Copy link
Owner

Jan0660 commented Apr 24, 2025

Thanks for the contribution! ... and sorry for not looking at this for a while.

@Jan0660 Jan0660 merged commit a3849ed into Jan0660:main Apr 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants