paritytech / polkadot-sdk-docs

_THE_ Polkadot SDK Tutorial
19 stars 0 forks source link

Prototype an md-book version of the crate #38

Open juangirini opened 8 months ago

juangirini commented 8 months ago

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

juangirini commented 8 months ago

@sam0x17 is this something you can help us with?

sam0x17 commented 8 months ago

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

juangirini commented 8 months ago

Adding some context https://github.com/sam0x17/docify/issues/23

nuke-web3 commented 6 months ago

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.

sam0x17 commented 6 months ago

Yeah my understanding is it is mostly embedding/CSS motivated

nuke-web3 commented 5 months ago

I have been considering https://github.com/sam0x17/docify/issues/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 https://github.com/paritytech/polkadot-sdk/pull/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?

sam0x17 commented 5 months ago

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.