From a1a85d08af93e8a3b90ddefe2f6213850e61b29b Mon Sep 17 00:00:00 2001 From: Neil Cuzon <58763315+NeilCuzon@users.noreply.github.com> Date: Wed, 22 Jul 2020 21:28:02 -0700 Subject: [PATCH] Update n00b-gettingStarted.md --- docs/n00b-gettingStarted.md | 80 ++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/docs/n00b-gettingStarted.md b/docs/n00b-gettingStarted.md index 7da2a7fc6..ed2461afc 100644 --- a/docs/n00b-gettingStarted.md +++ b/docs/n00b-gettingStarted.md @@ -5,15 +5,16 @@ Creating diagrams and charts using mermaid code is simple. The code is turned into a diagram in the web page with the use of a mermaid renderer. The mermaid renderer is a piece of javascript that parses mermaid definitions, when called. -This then renders a diagram based on that code, which can be seen as +This then renders a diagram based on that code in SVG, alternatively it -Most web browsers, such as Firefox, Chrome and Safari, can render mermaid, Internet Explorer however cannot. The web browser also needs access to the online mermaid renderer which it downloads from https://cdn.jsdelivr.net/npm/mermaid +Most web browsers, such as Firefox, Chrome and Safari, can render mermaid, Internet Explorer however cannot. -## For beginners, there are three relatively easy ways you can use mermaid: -1. Using the mermaid [live editor](https://mermaid-js.github.io/mermaid-live-editor/) +## For beginners, there are four relatively easy ways you can use mermaid: +1. Using the mermaid [live editor](https://mermaid-js.github.io/mermaid-live-editor/) For some popular video tutorials on the live editor go to [Overview](./n00b-overview.md). 2. Using one of the many [mermaid plugins](https://mermaid-js.github.io/mermaid/#/integrations). -3. Calling mermaid renderer with HTML, deployed in a friendly browser. - +3. Calling mermaid renderer with HTML,click here for more in depth information on [Usage](./usage.md). +4. Installing mermaid with npm and deploying it using a relative link in the ` + ``` -### b. The embedded mermaid code is similarly placed inside a `
` tag: +### b. The embedded mermaid diagram definition is similarly placed inside a `
` tag: ``` @@ -116,7 +119,7 @@ This is what needs to go into the html file:
``` -(take note that every mermaid chart/graph/diagram, has to have separate `
` tags.) +(take note that every mermaid chart/graph/diagram definition, has to have separate `
` tags.) ### c. When initializing mermaid using `mermaid.initialize()`, mermaid takes all the `
` tags it can find in the html body and starts to render them one by one. This is done like so: @@ -128,11 +131,12 @@ This is what needs to go into the html file: ### *Finally* ### If the three steps mentioned are followed you will end up with something like this: +### Note that ``` - + Here is one mermaid diagram: @@ -153,16 +157,54 @@ This is what needs to go into the html file: ``` -### Save this to an html file and open it with a browser from the web server (or just drag it into your web browser window) and voila! +### Save this to an html file and open it with a browser. --- +## 4. Calling mermaid from a relative link. +This method is similar to 3, if only a little more involved. The difference may be very subtle even, insignificant to a majority of people, but it offers its own advantages. + +1. install node v10 or 12, which would have npm + +2. download yarn using npm. +npm install -g yarn + +3. After yarn installs, enter the following command: + yarn add mermaid + +4. After downloading mermaid, you can then open the mermaid you’ve downloaded and go to the `dist` folder. + +5. Find the `mermaid.min.js` file, press the shift key and right click on and select copy as path from the options. + +6. Paste it within the `script` tag as the `src`. +``` + + +``` +7. It should look something like this +``` + + +``` +8. Add the graph and diagram definitions as you would in number 3, be mindful of the `div` tags. + +9. Save, load/edit your HTML file to your liking. + + +**Note** placing the HTML file on the same folder the mermaid filed you've downloaded is a good practice and allows you to shorten the address. + +**As seen here:** +``` + +``` + + **Three additional comments from Knut Sveidqvist, creator of mermaid:** - In early versions of mermaid, the `