paritytech/polkadot-sdk-docs

Prototype an md-book version of the crate

Opened this issue · 7 comments

Prototype a md-book version of the same crate. It should use docify-cli.

@sam0x17 is this something you can help us with?

Yeah the idea here would be giving docify the ability to output an mdbook similar to how it can already compile markdown files. Once I am done with the other features that I am finishing up, this could be a good next target

I have never worked with generating mdbooks directly so if they are all defined in markdown then this honestly will already just work with docify's markdown directory compiling feature, so it could be quite easy

Adding some context sam0x17/docify#23

I am interested in the motivation for this issue: what does mdBook provide that RustDocs does not exactly? As I read it, in the context mentioned in docify#23 , perhaps exposing (almost) the same information as Rustdocs is desired... Why?

Perhaps the motivation is to have a higher level book that exposes https://github.com/paritytech/polkadot-sdk/tree/master/docs in a more typical end user docs site than pure rust docs is?

If there is a more full writeup somewhere of the motivation/goals, please LMK 🙏

For ref, I have some experience with mdBook in crafting https://github.com/Polkadot-Blockchain-Academy/pba-book so hope the learning from that work could help, and perhaps even be combined into some main Book for the SDK that included or exposed/linked PBA materials as I think they are quite useful for end users WRT concepts mostly.

Yeah my understanding is it is mostly embedding/CSS motivated

I have been considering sam0x17/docify#23 and researching what feels best in DevEx for those writing docs & source. To me, use of mdBook's plugins with pure markdown and example code (that supports testing against source vs. a rust file with heavy doc comments would be cleaner and easier to use tooling/IDES for. (see also paritytech/polkadot-sdk#2991 that is a bit of a hybrid for split files, with the nice feature that rs files can use LSPs, where md example blocks afaik cannot).

It might to me to be possible to use docify to tightly couple rust docs build, so you can develop and test examples with a "pure" mdBook (with option to do hybrid, as mentioned). The missing link 😉 is called out in the issue mentioned though... Handling [`Trait`] links in mdBook... I think this could be handled by some mdbook plugin and cargo hooks / a build.rs file. I have been experimenting towards that end but nothing to show just yet. I am not sure, but it may be possible to inject the book in full into rustdocs so it lives on docs.rs for SEO, if not, using docify to build them in rustdocs direct should work as it does in that hybrid example.

WDYT about a push towards a "real" mdBook that is tightly coupled with cargo to get the testing, building, and linking working?

Handling [`Trait`] links in mdBook... I think this could be handled by some mdbook plugin and cargo hooks / a build.rs file.

Yeah you hit the nail on the head here, my whole reason for advocating a rustdocs-based approach is the built in handling for these things which are actually quite non-trivial when you have re-exports of re-exports of re-exports coming into play in module resolution.