我正在使用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 "foo",
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 "foo", 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/