Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: convert to use yard for documentation #1996

Closed
flavorjones opened this issue Feb 16, 2020 · 6 comments
Closed

RFC: convert to use yard for documentation #1996

flavorjones opened this issue Feb 16, 2020 · 6 comments

Comments

@flavorjones
Copy link
Member

We're already using yard to generate the docs at https://nokogiri.org/rdoc/index.html, but we're not taking advantage of some of yard's features (like the ability to embed mixin methods, e.g., Searchable in Node and NodeSet), and we're certainly not using yard syntax (e.g., all the call-seq annotations that we currently use are ignored).

So I'm thinking it would be best to convert the doc formatting to be yard-compatible markdown, and eliminate rdoc format entirely from the codebase.

I'd love to hear comments on this proposal.

Note to future self: try using https://github.com/postmodern/hoe-yard to drive some of this; and then have the nokogiri.org docs task just call nokogiri's own rake task for the site generation.

flavorjones added a commit to sparklemotion/nokogiri.org that referenced this issue Feb 16, 2020
@flavorjones
Copy link
Member Author

Note that one of the big reasons I'd like to do this is to start grouping methods in large classes like XML::Node, and so I'm watching lsegal/yard#1238 which is driving the ability to use @!group in C code.

flavorjones added a commit that referenced this issue Feb 25, 2020
and do the same for Searchable

related to #1996
@flavorjones
Copy link
Member Author

Of course, I'm noticing now that RDoc supports much of what I wanted to use yard for, including:

  • :category: directive to group methods
  • markdown support (not a blocker, but there it is)
  • :include: directive to pull in methods from mixins (though this might already work out of the box via RDoc::Mixin? geez, I really need to read the RDoc manual)

So maybe this issue should be reviewed, and either closed or rewritten to be outcome-oriented (instead of solution-oriented).

@flavorjones
Copy link
Member Author

After thinking about the foundational nature of Nokogiri in the ecosystem, I think we should use RDoc to ensure that as many folks as possible are able to generate and read the doc strings.

After reading docs, I think we can use RDoc without making it challenging for folks to navigate those docs, thanks to the :category: and :include: directives, etc.

@flavorjones
Copy link
Member Author

Flip-flopping on this. I'm choosing YARD over RDoc/SDoc because:

  • allows complete specification of argument types and return types
    • potentially generating Sorbet/RBI/RBS files
  • looks nicer than RDoc/SDoc
  • is less problematic than SDoc templates
    • SDoc template doesn't have URL magic in the browser bar like the Rails template does
    • Rails template doesn't support relative prefix so I can't deploy under https://nokogiri.org/rdoc/

@flavorjones
Copy link
Member Author

Flip-flopping again, and investing in making RDoc better:

@flavorjones
Copy link
Member Author

Note that RDoc's Markdown parser emits docs that don't look quite right throughout the RDoc toolchain (e.g., ri), so although I'd prefer to use Markdown, I'm going to use RDoc::Markup within the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant