Diffstat (limited to 'src/doc_macro.rs')
-rw-r--r--src/doc_macro.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/doc_macro.rs b/src/doc_macro.rs
new file mode 100644
index 0000000..6cf009a
--- /dev/null
+++ b/src/doc_macro.rs
@@ -0,0 +1,17 @@
+macro_rules! mermaid {
+ ($file:literal, $height:literal) => {
+ concat!(
+ "<pre class=\"mermaid\" style=\"padding:0;max-height:90vh;height:",
+ stringify!($height),
+ "vw;\">\n",
+ "<div style=\"visibility:hidden;\">\n",
+ include_str!($file),
+ "\n<div>\n",
+ "</pre>\n\n",
+ "<script type=\"module\">\n",
+ include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc_mermaid_injector.js")),
+ "</script>\n\n"
+ )
+ };
+}
+pub(crate) use mermaid;