shnewto / bnf

Parse BNF grammar definitions
MIT License
256 stars 22 forks source link

Include README.md as documentation in lib.rs #95

Closed CrockAgile closed 2 years ago

CrockAgile commented 2 years ago

There is a lot of duplication in the documentation between README.md and lib.rs

I can see two problems with this:

Maybe these problems don't outweigh some of the benefits? I am not sure! But usually reducing duplication is worth a discussion.

The documentation could be simplified down into one file via:

#![doc = include_str!("README.md")]

This would give both README.md and lib.rs the same content. It would also run the README.md code snippets as tests!

Current Differences

only README.md has:

only lib.rs has:

So considering the above, the only question I wanted to answer was how the badges look in rustdoc:

image

They seem fine!

So what do you think @shnewto ?

shnewto commented 2 years ago

wow, that's dreamy. i had no idea it was as easy as just

#![doc = include_str!("README.md")]

Very welcome change!!

I think if there's any discrepancy between the two, defaulting to what's in the README would be my preference, i.e. the "inspired by" is still sorta true but I removed it from the README because project's grown past the early bit of code that was doing similar things.

CrockAgile commented 2 years ago

Woo! then gonna hold off on this until after #92 is merged, since some conflicts would happen