Diagrams
Draw flowcharts, sequence diagrams and other charts from plain text with . The diagram source stays in the Markdown file, so it is easy to review and update.
See it
Use it
Diagrams are off by default because the Mermaid library is large. Add to the providers of your application:
app.config.tsTypeScriptLines 2, 6
import { ApplicationConfig } from '@angular/core';
import { provideMermaid } from '@ng-doc/app';
export const appConfig: ApplicationConfig = {
providers: [
provideMermaid (),
// ...the other NgDoc providers
],
};Then write a code block with the language:
index.mdMarkdown
```mermaid
flowchart LR
page["ng-doc.page.ts"] --> markdown["index.md"]
markdown --> html["Rendered page"]
api["ng-doc.api.ts"] --> html
``` Options
accepts a Mermaid configuration object and passes it to Mermaid's initialize() function. NgDoc renders diagrams itself, so it always sets startOnLoad to false.
app.config.tsTypeScript
provideMermaid ({ theme: 'neutral' });Sequence diagrams
index.mdMarkdown
```mermaid
sequenceDiagram
participant Author
participant NgDoc
participant Browser
Author->>NgDoc: Save index.md
NgDoc->>Browser: Updated page
``` Gotchas
WarningWithout
, a page with aprovideMermaid ()block throws the error "Mermaid is not provided" when the page renders, and the diagram doesn't appear.mermaid
Next: