mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Fixed double quotes, docs, demo and added more examples to run script
This commit is contained in:
@@ -18,20 +18,48 @@
|
|||||||
<h2>Energy flow</h2>
|
<h2>Energy flow</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Agricultural 'waste',Bio-conversion,124.729
|
%% There are leading and trailing spaces, do not crop
|
||||||
|
Agricultural 'waste',Bio-conversion,124.729
|
||||||
|
%% line with a comment
|
||||||
|
|
||||||
|
%% Normal line
|
||||||
Bio-conversion,Liquid,0.597
|
Bio-conversion,Liquid,0.597
|
||||||
|
|
||||||
|
%% Line with unquoted sankey keyword
|
||||||
|
sankey,target,10
|
||||||
|
|
||||||
|
%% Quoted sankey keyword
|
||||||
|
"sankey",target,10
|
||||||
|
|
||||||
|
%% Another normal line
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
Bio-conversion,Solid,280.322
|
|
||||||
|
%% Line with integer amount
|
||||||
|
Bio-conversion,Solid,280
|
||||||
|
|
||||||
|
%% Some blank lines in the middle of CSV
|
||||||
|
|
||||||
|
|
||||||
|
%% Another normal line
|
||||||
Bio-conversion,Gas,81.144
|
Bio-conversion,Gas,81.144
|
||||||
Biofuel imports,Liquid,35
|
|
||||||
Biomass imports,Solid,35
|
%% Quoted line
|
||||||
|
"Biofuel imports",Liquid,35
|
||||||
|
|
||||||
|
%% Quoted line with escaped quotes inside
|
||||||
|
"""Biomass imports""",Solid,35
|
||||||
|
|
||||||
|
%% Lines containing commas inside
|
||||||
|
%% Quoted and unquoted values should be equal in terms of graph
|
||||||
|
"District heating","Heating and cooling, commercial",22.505
|
||||||
|
District heating,"Heating and cooling, homes",46.184
|
||||||
|
|
||||||
|
%% A bunch of lines, normal CSV
|
||||||
Coal imports,Coal,11.606
|
Coal imports,Coal,11.606
|
||||||
Coal reserves,Coal,63.965
|
Coal reserves,Coal,63.965
|
||||||
Coal,Solid,75.571
|
Coal,Solid,75.571
|
||||||
District heating,Industry,10.639
|
District heating,Industry,10.639
|
||||||
District heating,Heating and cooling - commercial,22.505
|
|
||||||
District heating,Heating and cooling - homes,46.184
|
|
||||||
Electricity grid,Over generation / exports,104.453
|
Electricity grid,Over generation / exports,104.453
|
||||||
Electricity grid,Heating and cooling - homes,113.726
|
Electricity grid,Heating and cooling - homes,113.726
|
||||||
Electricity grid,H2 conversion,27.14
|
Electricity grid,H2 conversion,27.14
|
||||||
@@ -85,8 +113,12 @@
|
|||||||
Thermal generation,District heating,79.329
|
Thermal generation,District heating,79.329
|
||||||
Tidal,Electricity grid,9.452
|
Tidal,Electricity grid,9.452
|
||||||
UK land based bioenergy,Bio-conversion,182.01
|
UK land based bioenergy,Bio-conversion,182.01
|
||||||
Wave,Electricity grid,19.013
|
"""Wave""",Electricity grid,19.013
|
||||||
Wind,Electricity grid,289.366
|
"""Wind""",Electricity grid,289.366
|
||||||
|
|
||||||
|
%% lines at the end, do not remove
|
||||||
|
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
@@ -93,7 +93,7 @@ Thermal generation,District heating,79.329
|
|||||||
Tidal,Electricity grid,9.452
|
Tidal,Electricity grid,9.452
|
||||||
UK land based bioenergy,Bio-conversion,182.01
|
UK land based bioenergy,Bio-conversion,182.01
|
||||||
"""Wave""",Electricity grid,19.013
|
"""Wave""",Electricity grid,19.013
|
||||||
Wind,Electricity grid,289.366
|
"""Wind""",Electricity grid,289.366
|
||||||
|
|
||||||
%% lines at the end, do not remove
|
%% lines at the end, do not remove
|
||||||
|
|
||||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
@@ -50,8 +50,8 @@ opt_eof: EOF | ;
|
|||||||
|
|
||||||
record
|
record
|
||||||
: field\[source] COMMA field\[target] COMMA field\[value] {
|
: field\[source] COMMA field\[target] COMMA field\[value] {
|
||||||
const source = yy.findOrCreateNode($source.trim());
|
const source = yy.findOrCreateNode($source.trim().replaceAll('""', '"'));
|
||||||
const target = yy.findOrCreateNode($target.trim());
|
const target = yy.findOrCreateNode($target.trim().replaceAll('""', '"'));
|
||||||
const value = parseFloat($value.trim());
|
const value = parseFloat($value.trim());
|
||||||
yy.addLink(source,target,value);
|
yy.addLink(source,target,value);
|
||||||
} // parse only 3 fields, this is not part of CSV standard
|
} // parse only 3 fields, this is not part of CSV standard
|
||||||
|
@@ -230,7 +230,7 @@ Pumped heat,"Heating and cooling ""homes""",193.026
|
|||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
### Coloring and Фlignment
|
### Coloring and Alignment
|
||||||
|
|
||||||
You can change graph layout by setting `nodeAlignment` to:
|
You can change graph layout by setting `nodeAlignment` to:
|
||||||
|
|
||||||
|
17
run
17
run
@@ -28,13 +28,18 @@ help)
|
|||||||
# Alignment of help message must be as it is, it will be nice looking when printed
|
# Alignment of help message must be as it is, it will be nice looking when printed
|
||||||
usage=$(
|
usage=$(
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Run commands within docker containers.
|
|
||||||
|
|
||||||
Development quick start guide:
|
Welcome to Mermaid Local Docker Development
|
||||||
|
Script for runnign commands within docker containers.
|
||||||
|
__________________________________________________________________________________________
|
||||||
|
|
||||||
|
\033[1mDevelopment quick start guide\033[0m:
|
||||||
|
|
||||||
\033[1m$name pnpm install\033[0m # Install packages
|
\033[1m$name pnpm install\033[0m # Install packages
|
||||||
\033[1m$name dev\033[0m # Run dev server with examples, open http://localhost:9000
|
\033[1m$name dev\033[0m # Run dev server with examples, open http://localhost:9000
|
||||||
\033[1m$name docs:dev\033[0m # For docs contributions, open http://localhost:3333
|
\033[1m$name pnpm build\033[0m # Prepare it for production
|
||||||
|
\033[1m$name docs:dev\033[0m # Then add documentation, open http://localhost:3333
|
||||||
|
__________________________________________________________________________________________
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
|
||||||
@@ -45,16 +50,16 @@ $name docs:dev # For docs contributions, open http://localhost:33
|
|||||||
$name sh # Open 'sh' inside docker container for development
|
$name sh # Open 'sh' inside docker container for development
|
||||||
|
|
||||||
$name help # Show this help
|
$name help # Show this help
|
||||||
|
__________________________________________________________________________________________
|
||||||
|
|
||||||
Examples of frequiently used commands:
|
Examples of frequiently used commands:
|
||||||
|
|
||||||
$name pnpm add # Add package, 'run add d3-sankey'
|
$name pnpm add # Add package, 'run add d3-sankey'
|
||||||
$name pnpm prettier --write # Prettify a file 'run prettier <path-to-file>'
|
$name pnpm prettier --write # Prettify a file 'run prettier <path-to-file>', e.g.:
|
||||||
# git diff --name-only develop | xargs run pnpm prettier --write
|
# 'git diff --name-only develop | xargs run pnpm prettier --write'
|
||||||
$name pnpm test # Run unit tests
|
$name pnpm test # Run unit tests
|
||||||
$name pnpm vitest # Run watcher for unit tests
|
$name pnpm vitest # Run watcher for unit tests
|
||||||
$name pnpm e2e # Run integration tests
|
$name pnpm e2e # Run integration tests
|
||||||
$name pnpm -w run lint:fix
|
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user