Skip to content

Commit d115673

Browse files
committed
Post rebase changes
1 parent db3057b commit d115673

File tree

7 files changed

+161
-493
lines changed

7 files changed

+161
-493
lines changed

docs-src/0.6/src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
- [Resource](reference/use_resource.md)
9595
- [UseCoroutine](reference/use_coroutine.md)
9696
- [Spawn](reference/spawn.md)
97-
- [Cheat Sheet](reference/cheat_sheet.md)
9897

9998
---
10099
- [Contributing](contributing/index.md)

docs-src/0.7/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
- [In-Depth](guides/depth/index.md)
126126
- [Asset Pipeline](guides/depth/assets.md)
127127
- [Custom Renderer](guides/depth/custom_renderer.md)
128+
- [Cheat Sheet](guides/cheat_sheet.md)
128129
- [Migration](migration/index.md)
129130
- [To 0.7](migration/to_07.md)
130131
- [To 0.6](migration/to_06.md)
File renamed without changes.

packages/docs-router/src/doc_examples/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub use crate::{DemoFrame, SandBoxFrame, ComponentWithLogs, FakePage, CodeBlock, log, LogState, TwoPanelComponent};
1+
pub use crate::{DemoFrame, SandBoxFrame, ComponentWithLogs, FakePage, CodeBlock, log, LogState, TwoPanelComponent, MermaidBlock};
22

33
// Include any examples we compile into the docsite
44
#[cfg(not(feature = "doc_test"))]

packages/docs-router/src/docs.rs

Lines changed: 0 additions & 152 deletions
This file was deleted.

packages/docs-router/src/lib.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,51 @@ pub fn CodeBlock(contents: String, name: Option<String>) -> Element {
157157
}
158158
}
159159

160+
#[component]
161+
pub fn MermaidBlock(chart: &'static str) -> Element {
162+
rsx! {
163+
div {
164+
document::Link { rel: "stylesheet", href: asset!("assets/mermaid_block.css") }
165+
div {
166+
class: "mermaid min-h-[60vh]",
167+
style: "background-color: #fff; ",
168+
"value": "{chart}",
169+
}
170+
script { r#type: "module",
171+
r#"
172+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/+esm';
173+
import Panzoom from 'https://cdn.jsdelivr.net/npm/@panzoom/[email protected]/+esm';
174+
175+
mermaid.initialize({{
176+
startOnLoad: false,
177+
}});
178+
179+
const mermaidElements = document.querySelectorAll('.mermaid');
180+
let elements = [];
181+
mermaidElements.forEach((element, index) => {{
182+
if (element.getAttribute('data-processed') === 'true') {{
183+
return;
184+
}}
185+
element.textContent = element.value;
186+
elements.push(element);
187+
}});
188+
189+
mermaid.run().then(() => {{
190+
elements.forEach((element, index) => {{
191+
let svg = element.firstElementChild;
192+
const panzoom = Panzoom(svg, {{
193+
step: 1,
194+
maxScale: 10,
195+
minScale: 0.5,
196+
}});
197+
element.addEventListener('wheel', panzoom.zoomWithWheel);
198+
}})
199+
}});"#
200+
}
201+
}
202+
}
203+
}
204+
160205
pub(crate) static Copy: Component<()> = |_| {
161206
rsx!(
162207
svg {

0 commit comments

Comments
 (0)