如何使用 RDoc 标记呈现逐字记录/代码/前置加号?

发布于 2024-12-11 20:15:06 字数 1791 浏览 0 评论 0原文

使用 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微暖i 2024-12-18 20:15:07

这是一个错误,已在院子中修复: https://github.com/lsegal/yard/issues/ 403

This was a bug and fixed in yard: https://github.com/lsegal/yard/issues/403.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文