语法突出显示带有链接的 HTML
是否有可用的工具可以将给定的源代码转换为带有链接的 HTML?
我所说的链接是指所使用的每种类型、类和方法都将通过 href 指向其定义。
我还没有设法使突出显示、语法突出显示或 pygments 都以这种方式工作。即使它支持ctags输入,也只是添加标题属性,而不添加链接。
Is there a tool available which would convert the sources given into HTML with links?
By links I mean that every type, class, and method used would point via href to its definition.
I haven't managed to make highlight, syntax-highlight, nor pygments work this way. Even if it supports input from ctags, it only adds the title attribute, but not links.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Highlight 可以轻松修改以支持诸如添加函数/类定义的链接以及手册之类的功能条目。
我能够连接到类和函数检测,并在测试中将每个实例链接到 PHP 手册。我不知道您希望链接到什么,所以这是您的选择(当然,根据语言)。
Highlight can easily be modified to support things such as adding links to function / class definitions, as well as manual entries.
I was able to hook on to the class and function detection, and have each instance linked to the PHP Manual in my testing. I don't know what you'd want yours to link to, so it's your choice (per language, of course.)
根据源代码的语言,您可能需要使用 doxygen。它支持多种源语言,可以将注释导出为HTML和LaTeX。
许多现代语言(例如 Java 或 C#)都支持 XML 注释来记录源代码。然后,您可以通过使用特殊选项进行编译,将这些注释提取到单个 XML 文件中。然后,您可以通过添加适当的 CSS 表从该 XML 轻松生成 HTML。例如,MSDN 文档主要基于这些以自动模式生成的 HTML 文件。
Depending upon the language of your source code you might want to use doxygen. It supports a variety of source languages and can export the comments to HTML and LaTeX.
Many modern languages, like Java or C# support XML-comments to document the source code. You can then extract these comments into a single XML file by compiling them with special options. From this XML you can then easily produce HTML by adding an appropriate CSS sheet. MSDN documentation, for example, is largely based upon these HTML files generated in automated mode.