【问题标题】:Styling Encoded Text In Doxygen-Generated HTML在 Doxygen 生成的 HTML 中设置编码文本的样式
【发布时间】:2019-06-25 10:03:42
【问题描述】:

我正在使用 Doxygen 从 C# 代码生成一些 API 文档。

XML cmets 如下所示:

/// <summary>
/// Some summary text.
/// </summary>
/// <remarks>
/// Some remarks.
/// </remarks>
/// <param name="type">Type param</param>
/// <param name="id">ID param</param>
/// <response code="200"> OK</response>
/// <response code="400"> Bad Request</response>
/// <response code="500"> Internal Server Error</response>

Doxygen 为响应代码行生成的 HTML 如下所示:

<p>&lt;response code="200"&gt; OK&lt;/response&gt; &lt;response code="400"&gt; Bad Request&lt;/response&gt; &lt;response code="500"&gt; Internal Server Error&lt;/response&gt; </p>

所以响应代码行在生成的页面中呈现如下:

<response code="200"> OK</response> <response code="400"> Bad Request</response> <response code="500"> Internal Server Error</response>

当我希望它们像这样渲染时:

<response code="200"> OK</response>
<response code="400"> Bad Request</response>
<response code="500"> Internal Server Error</response>

我们无法更改格式化 XML cmets 中响应代码的方式,因为我们的 Swagger 工具依赖于这种格式。

  • 我不能使用别名,因为它不能进行文本匹配。它必须类似于 \response 或 @response。
  • 我尝试使用自定义 CSS 插入一些中断,但这不起作用,因为我们正在处理编码文本。
  • 我还尝试使用自定义 HTML 标头强制它呈现为 HTML5,但这也没有任何区别。

【问题讨论】:

  • 是否有定义&lt;response&gt;标签的权威文本,目前doxygen无法识别它,因为t不是C#标准Ecma-334中定义的标签。
  • @albert 我不这么认为。它只是在服务的 Swagger UI 中显示的自定义标签。我们不想为 Doxygen 调整它们,因为 (1) 它会导致它们在 Swagger 中被忽略或显示不正确,以及 (2) 即使它们在 Swagger 中工作,我们也必须在许多地方更新它们。 Doxygen 可以按原样处理它们的解决方案是可取的。
  • 从更新后的描述中,我不知道您可以接受什么。像 response{2}=\htmlonly &lt;response code="\1"&gt;\2&lt;/response&gt; 这样的 ALIASES 和像 \response{200,OK} 这样的呼叫是否可以接受?
  • 如果我正确理解别名,定义像 response="something" 这样的别名意味着 Doxygen 将在输入文件中查找 "@response" 的实例并将它们替换为文本 "something"。输入文件实际上包含“
  • .cs 源文件中的原始文件?是的。我很欣赏这些建议。我会尝试这些。

标签: c# doxygen


【解决方案1】:

我认为问题在于 未被 doxygen 识别为有效的xml command。但是您可以尝试将alias 添加到您的 doxygen 配置中,它将 转换为您选择的输出格式。

【讨论】:

  • 我试过了,但忘了提及。我更新了我原来的帖子。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-11-23
  • 2015-04-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-23
  • 2011-12-09
  • 1970-01-01
相关资源
最近更新 更多