如何在 YARD 文档中创建任意链接?

发布于 2024-08-02 08:44:43 字数 1090 浏览 6 评论 0 原文

我正在尝试在我的 YARD 文档中创建一些链接。我可以获得一个 HTTP 链接:

# I like {http://stackoverflow.com Stackoverflow}

呈现为

<p>I like <a href="http://stackoverflow.com">Stackoverflow</a></p>

但是电子邮件链接:

# You can email the {mailto:[email protected] bugs} list

给了我一个警告:

[warn]: In file `':: Cannot resolve link to mailto:bugs@myprojectmailto:[email protected] from text:

并呈现为

<p>You can email the <tt>bugs</tt> list</p>

我尝试过链接的常规 RDoc 语法:

bugs[mailto:[email protected]]

但 YARD 似乎忽略了这一点。有谁知道更可靠的语法?

I'm trying to create some links in my YARD documentation. I can get an HTTP link:

# I like {http://stackoverflow.com Stackoverflow}

renders as

<p>I like <a href="http://stackoverflow.com">Stackoverflow</a></p>

But an email link:

# You can email the {mailto:[email protected] bugs} list

gives me a warning:

[warn]: In file `':: Cannot resolve link to mailto:bugs@myprojectmailto:[email protected] from text:

and renders as

<p>You can email the <tt>bugs</tt> list</p>

I've tried the regular RDoc syntax for links:

bugs[mailto:[email protected]]

but YARD seems to ignore that. Does anyone know of a more reliable syntax?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

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

评论(2

很糊涂小朋友 2024-08-09 08:44:43

深入研究 YARD 的代码会发现问题:
gems/yard-0.2.3.5/lib/yard 有一行 (73):

if name.include?("://")

不允许 mailto 链接。你可以用它替换这条线

if name.include?("://") or name.include?("mailto:")

,它会按照你想要的方式工作......并不完全理想,但这就是我现在所拥有的。

Digging into YARD's code shows the problem: in
gems/yard-0.2.3.5/lib/yard there is the line (73):

if name.include?("://")

which doesn't allow mailto links. You can replace this line with

if name.include?("://") or name.include?("mailto:")

and it will work as you want... not exactly ideal, but that's all I've got right now.

迷迭香的记忆 2024-08-09 08:44:43

0.2.3.6 将有此支持

0.2.3.6 will have this support

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