如何在Java源文件中创建一个非URL可点击链接?

huangapple go评论63阅读模式
英文:

How do I create a non-URL clickable link in Java source file?

问题

以下是翻译好的部分:

"I am experimenting with Markdown and AsciiDoc to see if we can provide richer docs-as-code than we do today. This is very promising."

"我正在尝试使用Markdown和AsciiDoc,看看是否可以提供比我们今天更丰富的文档作为代码。这非常有潜力。"

"It is possible to link from an AsciiDoc file to a Java source file, so the reader can navigate the rendered version directly. It is also possible to put a URL in a comment in a Java source file which can be Ctrl-Click'ed to go there."

"可以从AsciiDoc文件链接到Java源文件,这样读者可以直接导航到渲染的版本。还可以在Java源文件的注释中放置一个URL,用户可以Ctrl-Click以跳转到那里。"

"Is there a special syntax that is understood by IntelliJ so it can be used in a similar way to easily navigate from a Java source file (Groovy and Kotlin are also interesting) to a non-source file? I'd prefer one that can be put on any comment like an URL, but if Javadoc can do it that is fine too."

"是否有一种特殊的语法,被IntelliJ理解,以便可以以类似的方式从Java源文件(Groovy和Kotlin也很有趣)轻松导航到非源文件?我更希望可以像URL一样放在任何注释中,但如果Javadoc可以实现这一点,那也可以。"

英文:

I am experimenting with Markdown and AsciiDoc to see if we can provide richer docs-as-code than we do today. This is very promising.

It is possible to link from an AsciiDoc file to a Java source file, so the reader can navigate the rendered version directly. It is also possible to put a URL in a comment in a Java source file which can be Ctrl-Click'ed to go there.

Is there a special syntax that is understood by IntelliJ so it can be used in a similar way to easily navigate from a Java source file (Groovy and Kotlin are also interesting) to a non-source file? I'd prefer one that can be put on any comment like an URL, but if Javadoc can do it that is fine too.

答案1

得分: 1

你可以以与链接其他内容相同的方式链接文件。例如,我在我的项目中的一个Asciidoc文件中有以下行:

link:./src/main/java/javax0/jamal/test/examples/Array.java[Array.java]

在使用IntelliJ asciidoctor插件编辑的Asciidoc文件中,右侧面板将显示一个链接。如果你在编辑器中点击它,它将打开Java文件。

相反地,如果在Java注释中有一个指向非Java文件的链接,我不太确定。如果你查看2014年的IntelliJ票据

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206181749-java-Viewing-links-in-source-code-comments

它已经对此进行了评论。

英文:

You can link a file the same way you would link anything else.
For example, I have the following line in an Asciidoc file in my project:

link:./src/main/java/javax0/jamal/test/examples/Array.java[Array.java]

in an Asciidoc file edited using the IntelliJ asciidoctor-based plugin will show you on the right pane a link. If you click on it in the editor, it will open the Java file.

The other way around, having a link in a Java comment pointing to a non-java file: I am not so sure. If you look at the IntelliJ ticket

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206181749-java-Viewing-links-in-source-code-comments

from 2014 it is already commenting on it.

huangapple
  • 本文由 发表于 2023年2月24日 01:13:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75548156.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定