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

[Example] Pure md files with docify for rustdoc and mdbook compatible format #2991

Closed
wants to merge 1 commit into from

Conversation

nuke-web3
Copy link
Contributor

Motivation

Writing great docs in markdown in the context of a rust doc comment is not so great, mostly due to IDEs not having great LSPs, linters, formatters, etc. support for markdown in comments vs. true md files. It's also very cumbersome to use rustdoc to build HTML for docs (see #2937 for some ideas there).

To ease the development of writing great docs, pulling md files that are included in rustdocs with md comments for docify to include updated and tested rust code

Nice thing with pure md is the protability as well: README that renders github (related to #2930) , includable in mdbook or other md tooling, that with docify includes updated, presumably CI tested, rust source code.

Example

Targets #2937 but the key here is the diff on that to this branch: pure markdown files to write docs that are then docify-ed to include rust snippets and then those generated .md files can (as proper and full markdown files) be used in rustdocs and pure md formats (like asked for in paritytech/polkadot-sdk-docs#38 )

To see this in action with a hacky method (easy to improve if the general direction of this work is agreed on):

  1. docify the docs/sdk/src/reference_docs/signed_extensions.docify.md file (this will error out as we are trying to include a md file about to be generated)
  2. rerun the build without docify file generation to yield rustdocs
# Fails, but generates md files that we latter include:
cargo doc -p polkadot-sdk-docs --no-default-features -F min-docs,gen-docify --no-deps

# Rustdocs yielded, with generated files from above.
clear && RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-default-features -F min-docs --no-deps --open

Next steps

If this seems like a desirable direction, happy to work on a better workflow and make a meta_contributing guide with some examples of such. Also could be an interesting thing to introduce as a workflow to PBA in the Book there, as slides are pure md that could be used in the same way with tested code snippets imported from the SDK here.

@nuke-web3 nuke-web3 added R0-silent Changes should not be mentioned in any release notes T11-documentation This PR/Issue is related to documentation. labels Jan 18, 2024
@nuke-web3 nuke-web3 self-assigned this Jan 18, 2024
@nuke-web3 nuke-web3 marked this pull request as draft January 18, 2024 23:25
@nuke-web3
Copy link
Contributor Author

leaving as a draft, as this should not be merged, but it's ready for review and comments on the idea cc @kianenigma @juangirini 🙏 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T11-documentation This PR/Issue is related to documentation.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants