如何使用 RDoc 标记呈现逐字记录/代码/前置加号?
使用 RDoc 标记并使用 Yard 生成文档,我试图记录一些命令输出,其中包含一行:
+----------------------------------+
...但不知道如何实现这一点。我怎样才能最终得到 HTML:
<pre class="code">
+----------------------------------+
</pre>
我确信我错过了文档中的一些琐碎的事情...
尝试 #1
在不尝试转义标记的情况下,我缩进了这 2 个空格(就像任何其他代码/ pre block):
+----------------------------------+
...生成文档,并获取 HTML (如预期的那样,我想):
<pre class="code">
<tt>----------------------------------</tt>
</pre>
尝试 #2
如果我使用反斜杠来转义,则此标记:
\+----------------------------------+
...将变为以下 HTML:
<pre class="code">
\+----------------------------------+
</pre>
尝试#3
奇怪的是,如果我连续使用两个加号,这个标记:
++----------------------------------+
... 变成这个 HTML:
<pre class="code">
++----------------------------------+
</pre>
Try #4
使用未缩进的 只会给我留下一个非“逐字记录”(即前/代码)部分;只是纯文本(再次,正如我所期望的那样):
<tt>+----------------------------------+</tt>
...变成这个 HTML:
<p>
<tt>-------------------------------------</tt>
</p>
尝试 #5
使用缩进的 变成这个标记:
<tt>+----------------------------------+</tt>
.. .到这个 HTML 中:
<pre class="code">
<tt>+----------------------------------+</tt>
</pre>
Using RDoc markup and generating docs with Yard, I'm trying to document some command output that has a line like:
+----------------------------------+
...but can't figure out how to achieve this. How can I end up with HTML:
<pre class="code">
+----------------------------------+
</pre>
I'm sure I missed something trivial in the docs...
Try #1
Without trying to escape the markup, I indent this 2 spaces (like any other code/pre block):
+----------------------------------+
...generate the docs, and get HTML (as expected, I suppose):
<pre class="code">
<tt>----------------------------------</tt>
</pre>
Try #2
If I use a backslash to escape, this markup:
\+----------------------------------+
...becomes this HTML:
<pre class="code">
\+----------------------------------+
</pre>
Try #3
Oddly enough, if I use two plus signs in succession, this markup:
++----------------------------------+
...becomes this HTML:
<pre class="code">
++----------------------------------+
</pre>
Try #4
Using unindented <tt>
just leaves me with a non-"verbatim" (i.e. pre/code) section; just plain-text (again, as expected, I suppose):
<tt>+----------------------------------+</tt>
...becomes this HTML:
<p>
<tt>-------------------------------------</tt>
</p>
Try #5
Using indented <tt>
turns this markup:
<tt>+----------------------------------+</tt>
...into this HTML:
<pre class="code">
<tt>+----------------------------------+</tt>
</pre>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个错误,已在院子中修复: https://github.com/lsegal/yard/issues/ 403。
This was a bug and fixed in yard: https://github.com/lsegal/yard/issues/403.