From 63064e6b8c76a622690ffb0ae784ba090756c07b Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 4 Apr 2024 22:32:01 +1100 Subject: [PATCH] Fix Mermaid diagram rendering (#3875) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/paritytech/polkadot-sdk/issues/2977 The issue appears to stem from the `aquamarine` crate failing to render diagrams in re-exported crates. e.g. as raised [here](https://github.com/paritytech/polkadot-sdk/issues/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 https://github.com/mersinvald/aquamarine/issues/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 --- .gitlab/pipeline/build.yml | 5 ++--- cumulus/test/service/src/chain_spec.rs | 2 +- docs/sdk/assets/after-content.html | 2 ++ docs/sdk/{headers => assets}/header.html | 2 ++ docs/sdk/{headers => assets}/theme.css | 0 prdoc/pr_3875.prdoc | 11 +++++++++++ substrate/frame/assets/src/lib.rs | 3 +-- 7 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 docs/sdk/assets/after-content.html rename docs/sdk/{headers => assets}/header.html (97%) rename docs/sdk/{headers => assets}/theme.css (100%) create mode 100644 prdoc/pr_3875.prdoc diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 3c870e576a8d..8658e92efc8f 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -91,7 +91,7 @@ build-rustdoc: - .run-immediately variables: SKIP_WASM_BUILD: 1 - RUSTDOCFLAGS: "--default-theme=ayu --html-in-header ./docs/sdk/headers/header.html --extend-css ./docs/sdk/headers/theme.css" + RUSTDOCFLAGS: "-Dwarnings --default-theme=ayu --html-in-header ./docs/sdk/assets/header.html --extend-css ./docs/sdk/assets/theme.css --html-after-content ./docs/sdk/assets/after-content.html" artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}-doc" when: on_success @@ -99,8 +99,7 @@ build-rustdoc: paths: - ./crate-docs/ script: - # FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features` - - time cargo doc --features try-runtime,experimental --workspace --no-deps + - time cargo doc --all-features --workspace --no-deps - rm -f ./target/doc/.lock - mv ./target/doc ./crate-docs # Inject Simple Analytics (https://www.simpleanalytics.com/) privacy preserving tracker into diff --git a/cumulus/test/service/src/chain_spec.rs b/cumulus/test/service/src/chain_spec.rs index 61bbf755d890..e86023576ac5 100644 --- a/cumulus/test/service/src/chain_spec.rs +++ b/cumulus/test/service/src/chain_spec.rs @@ -34,7 +34,7 @@ pub fn get_from_seed(seed: &str) -> ::Pu .public() } -/// The extensions for the [`ChainSpec`](crate::ChainSpec). +/// The extensions for the [`ChainSpec`]. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] #[serde(deny_unknown_fields)] pub struct Extensions { diff --git a/docs/sdk/assets/after-content.html b/docs/sdk/assets/after-content.html new file mode 100644 index 000000000000..30ae5c7ec430 --- /dev/null +++ b/docs/sdk/assets/after-content.html @@ -0,0 +1,2 @@ + + diff --git a/docs/sdk/headers/header.html b/docs/sdk/assets/header.html similarity index 97% rename from docs/sdk/headers/header.html rename to docs/sdk/assets/header.html index e28458c4ccc7..f55c31b53216 100644 --- a/docs/sdk/headers/header.html +++ b/docs/sdk/assets/header.html @@ -84,6 +84,8 @@ }); + +