我想包含一些 HTML 元素名称,例如 <label>
,在 Yard 生成的我的 ruby 类文档中。但它不起作用。例如,句子
# Returns a <label> field...
变成,经过Yard处理
Return a field...
<label>
元素实际上通过 Yard 逐字传递,使其作为原始 HTML 传递给浏览器。
我尝试使用 <label>
相反,它被转义了,所以我得到了 <label>
在生成的文档中。
谢谢!
最佳答案
堆场使用正常RDoc markup默认情况下:
By default, YARD is compatible with the same RDoc syntax most Ruby developers are already familiar with.
Putting a backslash before inline markup stops it being interpreted, which is how I created the table above:
_italic_:: \_word_ or \<em>text</em> *bold*:: \*word* or \<b>text</b> +typewriter+:: \+word+ or \<tt>text</tt>
这表明:
# Returns a \<label> field...
应该可行,但这对我没有任何用处,只是更多相同的“将其传递给 HTML”的废话。但是,包装 <label>
在 RDoc 的打字机标记中确实产生了一些有用的东西,所以试试这个:
# Returns a +<label>+ field...
关于ruby-on-rails - 如何在 Yard 文档中输出 HTML 元素名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9048963/