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

Update to use latest mermaid version for access to new diagram types #51

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 5 additions & 0 deletions demo/diagram_2.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packet-beta
0-15: "Option Length"
16-23: "Option Type"
24: "Discardable Flag"
25-31: "Reserved = 0x00"
18 changes: 11 additions & 7 deletions demo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// A function showcasing aquamarine defaults
///
/// With aquamarine it's possible to embed Mermaid diagrams into your Rust documentation using the code snippets
///
///
/// ```mermaid
/// graph LR
/// s([Source]) --> a[[aquamarine]]
Expand All @@ -28,8 +28,8 @@ pub fn example() {}
/// %%{init: {
/// 'theme': 'base',
/// 'themeVariables': {
/// 'primaryColor': '#ffcccc',
/// 'edgeLabelBackground':'#ccccff',
/// 'primaryColor': '#ffcccc',
/// 'edgeLabelBackground':'#ccccff',
/// 'tertiaryColor': '#fff0f0' }}}%%
/// graph TD
/// A(Diagram needs to be drawn) --> B{Does it have 'init' annotation?}
Expand All @@ -42,14 +42,18 @@ pub fn example_with_styling() {}

#[cfg_attr(doc, aquamarine::aquamarine)]
/// A diagram can be loaded from a file as well!
///
///
/// include_mmd!("diagram_0.mmd")
///
///
/// Reduce clutter in your doc comments, when a diagram is big enough.
///
///
/// You can include multiple diagrams in a single doc comment, using the macro-like syntax `include_mmd!("/path/to/diagram.mmd")`
///
///
/// include_mmd!(diagram_1.mmd)
///
/// Diagrams up to Mermaid version 11.1 are currently supported
///
/// include_mmd!(diagram_2.mmd)
///
/// **Note:** `indlude_mmd!` syntax is only supported inside doc comments
pub fn example_load_from_file() {}
2 changes: 1 addition & 1 deletion scripts/package_mermaid_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Usage: scripts/package_mermaid_release.sh doc/js https://cdn.jsdelivr.net/npm/mermaid@10/dist/ mermaid.esm.min.mjs

PKG_DIR="${1:-./doc/js}"
PKG_URL="${2:-https://cdn.jsdelivr.net/npm/mermaid@10.0.2/dist/}"
PKG_URL="${2:-https://cdn.jsdelivr.net/npm/mermaid@11.1.0/dist/}"
PKG_NAME="${3:-mermaid.esm.min.mjs}"

DOWNLOAD_DIR="${PKG_DIR}.dl"
Expand Down
2 changes: 1 addition & 1 deletion src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static MERMAID_JS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/doc/js/");
// base=document.getElementById("rustdoc-vars").attributes["data-root-path"]
const MERMAID_JS_LOCAL: &str = "static.files.mermaid/mermaid.esm.min.mjs";
const MERMAID_JS_LOCAL_DIR: &str = "static.files.mermaid";
const MERMAID_JS_CDN: &str = "https://unpkg.com/mermaid@10/dist/mermaid.esm.min.mjs";
const MERMAID_JS_CDN: &str = "https://unpkg.com/mermaid@11.1/dist/mermaid.esm.min.mjs";

const UNEXPECTED_ATTR_ERROR: &str =
"unexpected attribute inside a diagram definition: only #[doc] is allowed";
Expand Down