docs: Streamline pallet documentation exposed in the metadata #1632
Labels
I5-enhancement
An additional feature request.
T11-documentation
This PR/Issue is related to documentation.
Context
In metadata V15, a new docs field has been introduced.
The filed contains pallet documentation valuable for end-users (ie polkadot-js, subxt).
Problem
However, pallets are not documented in a way that exposes the documentation in the metadata.
For instance, the
system::pallet
lacks associated documentation:polkadot-sdk/substrate/frame/system/src/lib.rs
Lines 200 to 202 in 122086d
Proposal
To address this issue, substrate offers several methods for propagating documentation to the metadata:
polkadot-sdk/substrate/frame/support/procedural/src/lib.rs
Lines 266 to 280 in 122086d
Adding a
#[pallet_doc("../README.md")]
attribute on pallets is the most straight-forward solution to propagate documentation.However, this should be treated on a per-pallet basis being mindful that the documentation will also propagate when publishing crates.
There are three levels of documentation that we could leverage to streamline this process:
README.md
levelsrc/lib.rs
file-levelpub mod pallet
levelI would propose to share the
README.md
documentation at the file and pallet levels.Then, at the file level we could include extra details about pallets, or implementation details that might not be worth exposing in the metadata.
And at the pallet level respectively, the
README.md
documentation is propagated solely to the metadata.Would love to get your thoughts on this 🙏
cc @kianenigma @bkchr @paritytech/subxt-team
The text was updated successfully, but these errors were encountered: