-
Notifications
You must be signed in to change notification settings - Fork 27
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
How we integrated mermaid with our docs #20
Comments
There is a bug in rustdoc where the first line of a included markdown file may not be rendered properly in some cases. For now, you can add this to the top of a MD file that will be included in your docs to fix it
The extra line MUST be present before the first line of MD Content. This is only an issue for pulling MD files, not with mermaid supprot itself. |
github-merge-queue bot
pushed a commit
to paritytech/polkadot-sdk
that referenced
this issue
Apr 4, 2024
Closes #2977 The issue appears to stem from the `aquamarine` crate failing to render diagrams in re-exported crates. e.g. as raised [here](#2977), diagrams would render at `frame_support::traits::Hooks` but not the re-exported doc `frame::traits::Hooks`, even if I added `aquamarine` as a `frame` crate dependency. To resolve this, I followed advice in mersinvald/aquamarine#20 to instead render mermaid diagrams directly using JS by adding an `after-content.js`. --- Also fixes compile warnings, enables `--all-features` and disallows future warnings in CI. --------- Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de>
Ank4n
pushed a commit
to paritytech/polkadot-sdk
that referenced
this issue
Apr 9, 2024
Closes #2977 The issue appears to stem from the `aquamarine` crate failing to render diagrams in re-exported crates. e.g. as raised [here](#2977), diagrams would render at `frame_support::traits::Hooks` but not the re-exported doc `frame::traits::Hooks`, even if I added `aquamarine` as a `frame` crate dependency. To resolve this, I followed advice in mersinvald/aquamarine#20 to instead render mermaid diagrams directly using JS by adding an `after-content.js`. --- Also fixes compile warnings, enables `--all-features` and disallows future warnings in CI. --------- Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de>
dharjeezy
pushed a commit
to dharjeezy/polkadot-sdk
that referenced
this issue
Apr 9, 2024
Closes paritytech#2977 The issue appears to stem from the `aquamarine` crate failing to render diagrams in re-exported crates. e.g. as raised [here](paritytech#2977), diagrams would render at `frame_support::traits::Hooks` but not the re-exported doc `frame::traits::Hooks`, even if I added `aquamarine` as a `frame` crate dependency. To resolve this, I followed advice in mersinvald/aquamarine#20 to instead render mermaid diagrams directly using JS by adding an `after-content.js`. --- Also fixes compile warnings, enables `--all-features` and disallows future warnings in CI. --------- Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, decided to drop a line
First we created some
doc-assets
header.html:
after-content:
the magic is the
pre.language-mermaid
selector. When rustdoc renders a mermaid comment, it renders it in apre
element with class of.language-mermad
. So all we need to do is init the mermaid library with that selector.Then we run rustdoc with
And now any comment block with a mermaid comment inside it will render graphs. This works both in item and module comments.
Once doc directives get support for html-in-header and html-after-content, the special build command can go away.
The text was updated successfully, but these errors were encountered: