Skip to content

Commit 0dee447

Browse files
authored
feat: mermaid diagrams support (#71)
* wip: basic mermaid support * fix: regex for memraid * feat: support for mermaid * docs: update docs about diagrams
1 parent fa361df commit 0dee447

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

guide/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ You can learn more about the rationale behind the project in the [Why Slidev](/g
1616
- 🌈 [**Stylish**](/guide/syntax.html#embedded-styles) - [Windi CSS](https://windicss.org/) on-demand utilities, easy-to-use embedded stylesheets
1717
- 🤹 [**Interactive**](/custom/directory-structure.html#components) - embedding Vue components seamlessly
1818
- 🎙 [**Presenter Mode**](/guide/presenter-mode.html) - use another window, or even your phone to control your slides
19-
- 🧮 [**LaTeX**](https://sli.dev/demo/starter/6) - Built-in LaTeX math equations support
19+
- 🧮 [**LaTeX**](/guide/syntax.html#latex) - Built-in LaTeX math equations support
20+
- 📰 [**Diagrams**](/guide/syntax.html#diagrams) - Creates diagrams with textual descriptions
2021
- 🌟 [**Icons**](/guide/syntax.html#icons) - Access to icons from any iconset directly
2122
- 💻 [**Editors**](/guide/editors.html) - Integrated editor, or [extension for VS Code](https://github.com/slidevjs/slidev-vscode)
2223
- 🎥 [**Recording**](/guide/recording.html) - built-in recording and camera view
@@ -36,6 +37,7 @@ Slidev is made possible by combining these tools and technologies.
3637
- [VueUse](https://vueuse.org) family - [`@vueuse/core`](https://github.com/vueuse/vueuse), [`@vueuse/head`](https://github.com/vueuse/head), [`@vueuse/motion`](https://github.com/vueuse/motion), etc.
3738
- [Iconify](https://iconify.design/) - Iconsets collection.
3839
- [KaTeX](https://katex.org/) - LaTeX math rendering.
40+
- [Mermaid](https://mermaid-js.github.io/mermaid) - Textual Diagrams.
3941

4042
### Scaffolding Your First Presentation
4143

guide/syntax.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,31 @@ $$
259259
$$
260260
```
261261

262-
Learn more: [Demo](https://sli.dev/demo/starter/6) | [KaTeX](https://katex.org/) | [`markdown-it-katex`](https://github.com/waylonflinn/markdown-it-katex).
262+
Learn more: [Demo](https://sli.dev/demo/starter/7) | [KaTeX](https://katex.org/) | [`markdown-it-katex`](https://github.com/waylonflinn/markdown-it-katex)
263+
264+
## Diagrams
265+
266+
You can also create diagrams / graphs from textual descriptions in your Markdown, powered by [Mermaid](https://mermaid-js.github.io/mermaid).
267+
268+
Code blocks marked as `mermaid` will be converted to digrams, for example:
269+
270+
~~~md
271+
//```mermaid
272+
sequenceDiagram
273+
Alice->John: Hello John, how are you?
274+
Note over Alice,John: A typical interaction
275+
//```
276+
~~~
277+
278+
You can further pass an options object to it to specify the scaling and theming. The syntax of the object is a JavaScript object literal, you will need to add quotes (`'`) for strings and use comma (`,`) between keys.
279+
280+
~~~md
281+
//```mermaid {theme: 'neutral', scale: 0.8}
282+
graph TD
283+
B[Text] --> C{Decision}
284+
C -->|One| D[Result 1]
285+
C -->|Two| E[Result 2]
286+
//```
287+
~~~
288+
289+
Learn more: [Demo](https://sli.dev/demo/starter/8) | [Mermaid](https://mermaid-js.github.io/mermaid)

0 commit comments

Comments
 (0)