lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.92k stars 396 forks source link

Documentation on how to change the stylesheet should be easier to find #1181

Open unikitty37 opened 6 years ago

unikitty37 commented 6 years ago

The "getting started" documentation does not provide instructions on how to edit the stylesheet; it links to the Templates page which seems to be complete overkill if you just want to change the \ font from Monaco to Meslo DZ and tweak the colours a bit. (The Templates page is pretty unclear on this, too — I am still none the wiser on how to do this.)

There doesn't seem to be a --stylesheet flag on yardoc as far as I can see.

Steps to reproduce

This is the minimal reproduction for the issue. I've done my best to remove all extraneous code and unique environment state on my machine before providing these steps:

  1. Read the README and the "getting started" documentation.
  2. Run yard server --reload.
  3. Navigate to the URL provided.
  4. Decide to change the stylesheet.
  5. Search the documentation for terms such as "stylesheet" and "css" using the search box at https://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md.
  6. Try to use search terms such as "yard stylesheet", "yard rails stylesheet" and "yard rails documentation stylesheet" in DuckDuckGo.
  7. Try searching for "[yard] stylesheet" on StackOverflow.

Actual Output

There were no results returned for steps 5 and 7. Step 6 returned a load of results that did not pertain to Yard, plus a link to the homepage (the perils of using a common word for the project name, I guess :)

Expected Output

As many people want to change default stylesheets, whether for accessibility reasons or to make the generated docs conform to a house style, there should be instructions on how to do it as part of the Getting Started docs (even if it's just a link to a more in-depth page).

Ideally, there would be something like yardoc --dump-css which would output the stylesheet that it's going to use; the user could then save a copy of that, edit it, and tell yardoc to use it with yardoc --css <filename>.

Environment details:

  • OS: Mac OS X 10.12.6 (16G1408)
  • Ruby version (ruby -v): ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin16]
  • YARD version (yard -v): yard 0.9.14

I have read the Contributing Guide.

lsegal commented 5 years ago

The problem with adding a --stylesheet argument is that it's only specific to one type of document generation. The yard doc command can generate text or viz or md or other doc formats in which a --stylesheet or --dump-css would have no meaning.

YARD abstracts itself from the type of doc generation being performed, namely, HTML is the default format, but not the only supported format. More specifically, YARD doesn't enforce any formatting rules, that's up to the templating layer being used. In fact, overriding CSS isn't really understood by YARD at all, the CSS override functionality is a specific feature of the default/fulldoc/html template only. In other words, if you wrote a new template, the template itself would be responsible for providing similar overrides, if any.

I do agree, though, better documentation or more visibility for describing how to customize YARD's default html templates would be helpful here. Having an official .md document in the guide portion describing some common templating steps would be helpful. I would accept a PR for this if you're interested in taking it up.

wagenet commented 5 years ago