ruby - 如何在 Markdown 格式的 YARD 文档中插入项目符号 (<li>) 元素

标签 ruby documentation markdown yard

我正在使用YARDoc使用 Markdown 来记录我的 Ruby 代码,并希望在方法的文档中包含无序列表(HTML“项目符号”)。这是我到目前为止所拥有的:

$ cat file.rb
class Foo
  # Returns "foo", which consists of the letters:
  # * f
  # * o
  # * o
  def method; "foo"; end
end

我正在使用以下方法生成文档:

$ yard doc --markup markdown file.rb

但它不会生成 HTML 项目符号,而是将星号 ( * ) 视为文字字符。由此产生doc/Foo.html文件包含:

<span class="summary_desc"><div class='inline'><p>Returns &quot;foo&quot;,
which consists of the letters:
* f
* o
* o.</p>
</div></span>

如何在 YARD 中使用 Markdown 插入 HTML 项目符号? 我本质上希望上述输出中的每个字母都包含在 <li>...</li> 中。 ,并且该列表被 <ul> 包围元素。

最佳答案

我需要有一个空行来分隔第一行文本和列表的开头:

$ cat file.rb 
class Foo
  # Returns "foo", which consists of the letters:
  #
  # * f
  # * o
  # * o
  def method; "foo"; end
end

产生:

<div class="discussion">
  <p>Returns &quot;foo&quot;, which consists of the letters:</p>
  <ul>
    <li>f</li>
    <li>o</li>
    <li>o</li>
  </ul>
</div>

关于ruby - 如何在 Markdown 格式的 YARD 文档中插入项目符号 (<li>) 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16537148/

相关文章:

ruby-on-rails - 通过按钮调用 Ruby 方法

ruby - 有人说模块既有行为又有状态,这是什么意思?

Linq to SQL 的 C# XML 文档

documentation - Doxygen:分组模块和页面?

r - 如何避免表格(数据表)在 flexdashboard 容器中被其他文本截断?

ruby-on-rails - 如何删除并重新安装 rails 3.2.13

css - 检测 css 文件和 ruby​​ on rails 中的语法错误。无效的 CSS

c# - 在 XML 文档中使用 <see cref =""/> 和可选的可为空参数

c# - 记录 ActionResult 返回值的可接受方式

r - 在 rMarkdown 中使用 readline(prompt = "")