使用.NET代码文档XML时,将HTML标记在代码示例中包括在代码示例中

发布于 2025-02-09 11:41:27 字数 520 浏览 1 评论 0原文

.NET具有用于记录代码的特定XML语法。

< c></c> and < code>>>/code标签允许在注释中添加代码spets,但要保证,他们没有'''当这些代码片段由HTML制成时,t可以很好地工作,这是一个问题,因为我想记录我功能的HTML标记输出。

例如,如果我编写以下(vb)文档注释:

''' <summary>
''' <code>
''' <div class="foo">Hello world</div>
''' </code>
''' </summary>

当我用指针悬停函数的名称时,它确实显示了“ Hello World”字符串,但没有显示HTML标记。它似乎正在解释它。

是否有一种方法可以像这些注释中一样显示HTML标记?

只是要清楚,我不是要为文档添加样式,我真的希望它显示HTML标记本身。

.NET has a specific XML syntax for documenting the code.

The <c></c> and <code></code> tags allow to add code snippets into the comments, but apprently, they don't work well when those code snippets are made of HTML, which is a problem, because I would like to document the HTML markup output of my function.

For example, if I write the following (VB) documentation comment :

''' <summary>
''' <code>
''' <div class="foo">Hello world</div>
''' </code>
''' </summary>

It does display the "Hello world" string when I hover the function's name with my pointer, but does not show the HTML markup as is. It seems to be interpreting it instead.

Is there a way to display HTML markup as is within those comments ?

Just to be clear, I'm not trying to add styling to the documentation, I really want it to display the HTML markup itself.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只为一人 2025-02-16 11:41:27

使用CDATA:

''' <summary>
''' <code><![CDATA[
''' <div class="foo">Hello world</div>
''' ]]></code>
''' </summary>

例如,我的产品 vsdocman 具有评论编辑器,将CDATA放在<代码>&lt; code&gt; 自动阻止。

Use CDATA:

''' <summary>
''' <code><![CDATA[
''' <div class="foo">Hello world</div>
''' ]]></code>
''' </summary>

For example, my product VSdocman has the comment editor which puts CDATA in <code> blocks automatically.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文