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

Fix Mermaid diagram rendering #3875

Merged
merged 15 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ 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
expire_in: 1 days
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
Expand Down
50 changes: 0 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cumulus/test/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::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 {
Expand Down
2 changes: 2 additions & 0 deletions docs/sdk/assets/after-content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<script> mermaid.init({ startOnLoad: true, theme: "dark" }, "pre.language-mermaid > code");</script>

2 changes: 2 additions & 0 deletions docs/sdk/headers/header.html → docs/sdk/assets/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
});
</script>

<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>

<style>
body.sdk-docs {
nav.side-bar {
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions prdoc/pr_3875.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Fix Mermaid diagram rendering

doc:
- audience: Runtime Dev
description: |
Fixes the rendering of some Mermaid diagrams in the documentation.

crates: [ ]
1 change: 0 additions & 1 deletion substrate/frame/bags-list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ frame-election-provider-support = { path = "../election-provider-support", defau
# third party
log = { workspace = true }
docify = "0.2.7"
aquamarine = { version = "0.5.0" }

# Optional imports for benchmarking
frame-benchmarking = { path = "../benchmarking", default-features = false, optional = true }
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/bags-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(doc)]
#[cfg_attr(doc, aquamarine::aquamarine)]
///
/// In this example, assuming each node has an equal id and score (eg. node 21 has a score of 21),
/// the node 22 can be moved from bag 1 to bag 0 with the `rebag` operation.
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/executive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
aquamarine = "0.3.2"
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
//! ```

#[cfg(doc)]
#[cfg_attr(doc, aquamarine::aquamarine)]
/// # Block Execution
///
/// These are the steps of block execution as done by [`Executive::execute_block`]. A block is
Expand Down
2 changes: 0 additions & 2 deletions substrate/frame/support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ serde_json = { features = ["alloc"], workspace = true }
docify = "0.2.7"
static_assertions = "1.1.0"

aquamarine = { version = "0.5.0" }

[dev-dependencies]
assert_matches = "1.3.0"
pretty_assertions = "1.2.1"
Expand Down
17 changes: 8 additions & 9 deletions substrate/frame/support/src/traits/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ pub trait IntegrityTest {
fn integrity_test() {}
}

#[cfg_attr(doc, aquamarine::aquamarine)]
liamaharon marked this conversation as resolved.
Show resolved Hide resolved
/// The pallet hooks trait. This is merely an umbrella trait for:
///
/// - [`OnInitialize`]
Expand Down Expand Up @@ -370,16 +369,16 @@ pub trait IntegrityTest {
/// end
/// ```
///
/// * [`OnRuntimeUpgrade`](Hooks::OnRuntimeUpgrade) hooks are only executed when a code change is
/// detected.
/// * [`OnRuntimeUpgrade`](Hooks::OnRuntimeUpgrade) hooks are mandatorily executed at the very
/// beginning of the block body, before any extrinsics are processed.
/// * [`OnRuntimeUpgrade`](crate::traits::OnRuntimeUpgrade) hooks are only executed when a code
/// change is detected.
/// * [`OnRuntimeUpgrade`](crate::traits::OnRuntimeUpgrade) hooks are mandatorily executed at the
/// very beginning of the block body, before any extrinsics are processed.
/// * [`Inherents`](sp_inherents) are always executed before any other other signed or unsigned
/// extrinsics.
/// * [`OnIdle`](Hooks::OnIdle) hooks are executed after extrinsics if there is weight remaining in
/// the block.
/// * [`OnFinalize`](Hooks::OnFinalize) hooks are mandatorily executed after
/// [`OnIdle`](Hooks::OnIdle).
/// * [`OnIdle`](crate::traits::OnIdle) hooks are executed after extrinsics if there is weight
/// remaining in the block.
/// * [`OnFinalize`](crate::traits::OnFinalize) hooks are mandatorily executed after
/// [`OnIdle`](crate::traits::OnIdle).
///
/// > [`OffchainWorker`](crate::traits::misc::OffchainWorker) hooks are not part of this flow,
/// > because they are not part of the consensus/main block building logic. See
Expand Down
Loading