Question

I want to produce some documentation that is available publicly, and hence I wish to remove certain aspects of the output that Yard generates by default. Already I've managed to remove the source code and its link, but I'd also like to remove:

  • The class name.
  • The inheritance information.
  • The "defined in" info.
  • If possible, the "Class List" | "Method list" | "File list" menu.

I removed the source by adding:

def init
  super
  sections.first.delete(:source)
end

to the path .yard_templates/no_source/default/method_details/setup.rb and referring to it at generation time. (thanks to this answer)

As helpful as the maintainers have tried to be with the documentation on templates, I just don't see how to do this.

I've tried looking at the output and working backwards, and by inspecting sections from the code above but I don't see how to work out which section in the HTML output is represented by what in the code?

Any help or insight will be much appreciated.


Edit: I've found how to remove the inheritance info:

# place in .yard_templates/no_source/default/module/setup.rb
def init
  super
  sections.delete(:box_info)
end
Was it helpful?

Solution

Removing the "Class List" | "Method list" | "File list" menu:

Put the following code in .yard_templates/whatever-you've-called-this-dir/default/layout/html/setup.rb

def menu_lists
  []
end

Removing the inheritance information:

Put the following code in .yard_templates/whatever-you've-called-this-dir/default/module/setup.rb

def init
  super
  sections.delete(:box_info)
end

To remove the other info, get a copy of templates/default/layout/html/headers.erb from the Yardoc gem, and then place it at .yard_templates/whatever-you've-called-this-dir/default/layout/html/headers.erb and edit what you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top