使用yard创建文档时如何防止[查看源代码]链接? [英] How to prevent [view source] link when creating documentation using yard?
问题描述
我正在使用yard生成项目文档,但是我不想在文档中显示[查看源代码]链接,我已经深入了yard的官方指南,但仍然没有找到解决方案.
I am using yard to generate project documentation, but i don't want to display the [view source] link in the documentation, i have dived into the yard official guides but still don't get the solution.
有什么想法吗?谢谢.
推荐答案
我可能来得有点晚,但是您可以通过从method_details部分中删除"source"部分来简单地自定义默认模板.为此,您可以在项目的根目录中创建文件"my_template/default/method_details/setup.rb",内容如下:
I might be a little late but you can trivially customize the default template by removing the "source" section from the method_details partial. You can do so by creating the file "my_template/default/method_details/setup.rb" in the root of your project with the contents:
def init
super
sections.first.delete(:source)
end
然后,您可以通过自定义模板修改来调用YARD:
Then you can call YARD with your custom template modifications:
$ yardoc -p my_template
这篇关于使用yard创建文档时如何防止[查看源代码]链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!