-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
118 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,62 @@ | ||
# diagram | ||
|
||
Generating diagram from yaml/markdown. | ||
|
||
[Live Demo is avalable here!](http://awis.me/diagram/#diag=eyJkaWFncmFtIjoiZGVmYXVsdDpcbiAgd2lkdGg6IDEwMFxuICBoZWlnaHQ6IDEwMFxuICB0b3A6IDEwMFxuICBsZWZ0OiAxMDBcbiAgcGFkZGluZy1sZWZ0OiAxMHB4XG4gIHBhZGRpbmctcmlnaHQ6IDEwcHhcbm5vZGVzOlxuICBuMTpcbiAgICB0b3A6IDdweFxuICAgIGxlZnQ6IDg4cHhcbiAgICBib3JkZXI6IDBweFxuICAgIGhlaWdodDogMTIwXG4gICAgd2lkdGg6IDEyMFxuICAgIGJveC1zaGFkb3c6IDBweCAwcHggMHB4XG4gIG4yOlxuICAgIHRvcDogOHB4XG4gICAgbGVmdDogNzI4cHhcbiAgICBib3JkZXI6IDJweCBkYXNoZWQgZ3JlZW5cbiAgICB3aWR0aDogMjAwXG4gICAgaGVpZ2h0OiAyMDBcbiAgICBib3JkZXItcmFkaXVzOiAwXG4gIG4zOlxuICAgIHRvcDogMzkzcHhcbiAgICBsZWZ0OiA3NXB4XG4gICAgaGVpZ2h0OiAxNDBcbiAgICB3aWR0aDogMTAwXG4gICAgdGV4dC1hbGlnbjogbGVmdFxuICBuNTpcbiAgICB0b3A6IDExMHB4XG4gICAgbGVmdDogMjQycHhcbiAgICBoZWlnaHQ6IDE2MFxuICAgIHdpZHRoOiAzMDBcbiAgICBsaW5lLWhlaWdodDogMTZweFxuICAgIHRleHQtYWxpZ246IGxlZnRcbiAgbjQ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YUhhP3BpZD1JbWdEZXQmcnM9MSBcIjMwXCIpICpOb3RlKlxuMS4gRHJhZyZkcm9wIG5vZGUgdG8gcmUtcG9zaXRpb24gaXRcbjIuIERvdWJsZSBjbGljayBhIG5vZGUgdG8gZWRpdCBpdFxuMy4gU2VsZWN0ICdkaWFncmFtJyBpbiBkcm9wZG93biB0byBzdHlsZSBpdFxuXHQtIGN1c3RvbWl6ZSBub2RlIHNpemUgYW5kIGFwcGVyYW5jZSBcbiAgICAtIGN1c3RvbWl6ZSBsaW5rcyBiZXR3ZWVuIG5vZGVzXG40LiBmb3IgZXhhbXBsZTogYWRqdXN0XG5gYGBsaW5lLWhlaWdodDogMTZweGBgYCB0byBzZXQgbGluZSBoZWlnaHQuIiwibjQiOiIqbjQqXG5cbm5vdGUgaXMgZGVmaW5lZCBpbiBtYXJrZG93blxueW91IGNhbiBldmVuIHB1dCBhIHRhYmxlIGluIG5vZGU6XG5cbnwgdGVybSB8IGRlc2NyaXB0aW9uIHxcbnw6LS0tLS0tLXw6LS0tLS0tOnxcbnwgIG5vZGUgfCBhIHdpbmRvdyB3aXRoIHBpYyBhbmQgdGV4dHxcbnwgIGVkZ2UgfCBjb25uZWN0aW9uIGJldHdlZW4gdHdvIG5vZGVzfFxuXG4tLS1cbiogdXNlIHotaW5kZXggdG8gYnJpbmcgbm9kZSBiYWNrL2Zyb250XG4qIGN1c3RvbWl6ZSBiYWNrZ3JvdW5kLWNvbGVyXG5cbiFbXShodHRwczovL3RzZTItbW0uY24uYmluZy5uZXQvdGgvaWQvT0lQLUMuNzhtdDNwd2NTRHNpNEYwaDFvN2c0d0hhSGE/cGlkPUltZ0RldCZ3PTE4MCZoPTE4MCZycz0xIFwiNDVcIikifQ==) | ||
# The Idea | ||
|
||
* A diagram is a collection of nodes and edges. | ||
* A node is a diagram without sub nodes and edges. | ||
* A node is defined by a markdown file. | ||
* In the front matter section: | ||
* style: the attributes for the node, for example size, location, color, text align etc. | ||
* nodes: list of sub nodes. | ||
* edges: direction, style, label. | ||
* In the markdown body: the content of the node. | ||
* The location of one node can either be customized by modifying parameters in the markdown file, or drag & drop the generated node in the diagram. In the later case, the related paremeters, say ```top``` and ```left``` in markdown will be updated automatically. | ||
* The diagram can be exported in ```permlink``` address. All the information in the markdowns will be embedded in the exported URL. You can share the URL as a copy of the editable version of the diagram. | ||
# Markgraph | ||
|
||
```yaml | ||
--- | ||
name: node1 | ||
note: some tags or note | ||
follow: | ||
- parent1 | ||
- parent2 | ||
- parent3 | ||
nodes: | ||
- n1 | ||
- n2 | ||
- n3 | ||
- n4 | ||
edges: | ||
- from: n1 | ||
to: n2 | ||
label: 2️⃣ | ||
paintStyle: | ||
strokeWidth: 1 | ||
stroke: red | ||
- from: n2 | ||
to: n3 | ||
label: create | ||
- from: n3 | ||
to: n1 | ||
style: | ||
left: 626px | ||
top: 293px | ||
--- | ||
Markgraph stands for Markdown Graph Notes. | ||
|
||
The content of node 1 in markdonw format | ||
``` | ||
# Quick Start | ||
[Live Demo is avalable here!](http://awis.me/diagram/) | ||
|
||
1. modify each of the markdown file to define the content of each node | ||
2. copy the link address of the ```permlink``` and save it for future reference or sharing with friends. | ||
Please find a number of key features below: | ||
|
||
## diagram define example | ||
- Markdown | ||
- Markdown for writing document. | ||
- Graph | ||
- Mermaid to draw diagrams | ||
- Connect nodes to draw complex diagrams. | ||
|
||
Each document is a node, one node can have a number of sub nodes. The subnodes can be connected via arrows in different color, style etc. | ||
- Notes | ||
- There is no server needed. The app is a single page app running in your browser. | ||
- Every keystroke will be saved within one second. | ||
- Git like time machine to keep changes saved as snapshots, you can always go back to a previous snapshot. | ||
- Easy to import and export via a single text file. | ||
- Easy to share the document via an URL. | ||
|
||
## Terms used in markgraph | ||
|
||
Workspace | ||
: All the document you can access in markgraph UI. In the workspace, there is at least one Notes. | ||
|
||
## node define example | ||
Notes | ||
: A collection of document. There maybe several notes in the workspace. You can switch by selecting in the explorer. | ||
|
||
```Markdown | ||
 | ||
JSON | ||
``` | ||
Node | ||
: A node is a document. It can have sub nodes ( sub documents) too. | ||
|
||
# TODO | ||
Snapshot | ||
: A copy of the workspace. | ||
|
||
- [x] Use permlink to share editable diagram. URL parameter format: ```diag=.... ``` while the value is a serialized json object with below format: | ||
Explorer | ||
: A list view to show notes in current workspace, or nodes under current notes. | ||
|
||
```json | ||
{ | ||
"n1": "Markdown format string to define the format of node n1", | ||
"n2": "Markdown format string to define the format of node n2", | ||
... | ||
} | ||
``` | ||
Editor | ||
: An area for editing node. | ||
|
||
# HOWTO | ||
Canvas | ||
: The area to show the preview version of the node. | ||
|
||
## backup your drawing | ||
Outline | ||
: Showing a list of nodes, click on one item will jump to that node. | ||
|
||
Diagram internally use browser localStorage to keep the latest version of drawing. | ||
There are 3 kinds of URLs. | ||
## User's Manual | ||
|
||
1. https://awis.me/diagram/ | ||
2. https://awis.me/diagram/#diag=base64_encoded_diagram_data | ||
3. https://awis.me/diagram/#filename1 | ||
[The Manual itself is created using markgraph, and it is available online.](http://awis.me/diagram/) | ||
|
||
The first one and second one are using the default local storage key. Any modification to the diagram will update the local storage default file immediately. | ||
Please find below some screen capture of the manual. | ||
|
||
The third one explicitly choose a local storage key. | ||
|
||
If you need to edit multiple diagrams simutaniously, it's safe to use hash plus filename scheme in the URL. | ||
# Developement | ||
|
||
## Unit test | ||
|
||
``` | ||
npx jest --no-cache --verbose | ||
``` | ||
|
||
## Build | ||
|
||
``` | ||
npm run build | ||
``` | ||
|
||
## Deploy | ||
|
||
The deployment is easy, just build it and put all the generated files under /dist into your web server and it's done. | ||
|
||
If you are in a hurry, you can get a pre-built version below: | ||
|
||
https://github.com/xu4wang/xu4wang.github.io/tree/master/diagram | ||
|
||
Also, you can always use my deployed version. | ||
|
||
https://awis.me/diagram | ||
 | ||
 | ||
 | ||
 | ||
 | ||
 | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters