Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto transform mermaid-example in docs. #3401

Merged
merged 41 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cfae2b6
Doc transformer
sidharthv96 Sep 2, 2022
3b88150
Move docs to src
sidharthv96 Sep 3, 2022
bd14dc5
Build docs in lintstaged
sidharthv96 Sep 3, 2022
d01de85
Update doc test
sidharthv96 Sep 3, 2022
e34e208
Add auto generated docs
sidharthv96 Sep 3, 2022
9d5c50a
Update doc test
sidharthv96 Sep 3, 2022
0aabae4
Update doc test
sidharthv96 Sep 3, 2022
f45c0e3
Fail commit if docs changed
sidharthv96 Sep 3, 2022
b6d0d7f
Fail commit if docs changed
sidharthv96 Sep 3, 2022
cc38667
Add generated file to git
sidharthv96 Sep 3, 2022
017fdfa
Fail commit if docs changed
sidharthv96 Sep 3, 2022
c3da6c1
Add generated file to git
sidharthv96 Sep 3, 2022
829e1c2
Fix typo
sidharthv96 Sep 3, 2022
3833dcd
Add verification for doc change
sidharthv96 Sep 3, 2022
4225f5e
Turn off jsdoc warnings that were polluting logs
sidharthv96 Sep 3, 2022
13e7da1
Add doc verification to CI
sidharthv96 Sep 3, 2022
c2f7240
Test
sidharthv96 Sep 3, 2022
074f30e
Fix double rendering in docsify
sidharthv96 Sep 3, 2022
bdeefb2
Test
sidharthv96 Sep 3, 2022
0a30423
Fix Doc
sidharthv96 Sep 3, 2022
42a2cab
Remove "Edit this page"
sidharthv96 Sep 3, 2022
c702e12
Fix edit page url
sidharthv96 Sep 3, 2022
6167eda
Prettier
sidharthv96 Sep 3, 2022
1f7d8c0
Fix lint staged
sidharthv96 Sep 3, 2022
fe1be11
Fix lint staged
sidharthv96 Sep 3, 2022
787cf93
Prettier options
sidharthv96 Sep 3, 2022
661f283
Strict prettierrc
sidharthv96 Sep 3, 2022
f6d69b3
Prettier
sidharthv96 Sep 3, 2022
b84511b
Prettier
sidharthv96 Sep 3, 2022
c49c15a
Add dotfiles
sidharthv96 Sep 3, 2022
5674f8e
Prettier Pass
sidharthv96 Sep 3, 2022
0caf372
Fix configuration doc
sidharthv96 Sep 3, 2022
85dc16d
Add files only when running from lint-staged
sidharthv96 Sep 3, 2022
636017f
Add files only when running from lint-staged
sidharthv96 Sep 3, 2022
e718c5b
Fix doc
sidharthv96 Sep 3, 2022
22999e2
Merge branch 'develop' into sidv/docs
sidharthv96 Sep 4, 2022
f0c41a8
Fix lint issue
sidharthv96 Sep 4, 2022
537ce4f
Add change in `src/docs`
sidharthv96 Sep 4, 2022
a95f46f
Fix mermaid code formatting in html
sidharthv96 Sep 4, 2022
5e9db25
Merge branch 'develop' into sidv/docs
sidharthv96 Sep 5, 2022
5ae1bd9
Build docs
sidharthv96 Sep 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"jsdoc/multiline-blocks": "off",
"jsdoc/newline-after-description": "off",
"jsdoc/tag-lines": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-description": "off",
"cypress/no-async-tests": "off",
"json/*": ["error", "allowComments"],
"no-empty": ["error", { "allowEmptyCatch": true }]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ jobs:

- name: Run Linting
run: yarn lint

- name: Verify Docs
run: yarn docs:verify
7 changes: 5 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"*.{js,json,html,md}": [
"yarn lint:fix"
"src/docs/**": [
"yarn docs:build"
],
"*.{js,json,html,md}": [
"yarn lint:fix"
]
}
18 changes: 10 additions & 8 deletions docs/8.6.0_docs.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs.
# Version 8.6.0 Changes

## [New Mermaid Live-Editor Beta](https://mermaid-js.github.io/docs/mermaid-live-editor-beta/#/edit/eyJjb2RlIjoiJSV7aW5pdDoge1widGhlbWVcIjogXCJmb3Jlc3RcIiwgXCJsb2dMZXZlbFwiOiAxIH19JSVcbmdyYXBoIFREXG4gIEFbQ2hyaXN0bWFzXSAtLT58R2V0IG1vbmV5fCBCKEdvIHNob3BwaW5nKVxuICBCIC0tPiBDe0xldCBtZSB0aGlua31cbiAgQyAtLT58T25lfCBEW0xhcHRvcF1cbiAgQyAtLT58VHdvfCBFW2lQaG9uZV1cbiAgQyAtLT58VGhyZWV8IEZbZmE6ZmEtY2FyIENhcl1cblx0XHQiLCJtZXJtYWlkIjp7InRoZW1lIjoiZGFyayJ9fQ)
Expand All @@ -21,8 +22,8 @@ The three levels of are Configuration, Global, Site and Current.
| Site Configuration| Configurations made by site owner|
| Current Configuration| Configurations made by Implementors|


# Limits to Modifying Configurations

**secure Array**

| Parameter | Description |Type | Required | Values|
Expand All @@ -36,13 +37,14 @@ The modifiable parts of the Configuration are limited by the secure array, which
# Secure Arrays

Site owners can add to the **secure** array using this command:
mermaidAPI.initialize( { startOnLoad: true, secure: ['parameter1', 'parameter2'] } );
mermaidAPI.initialize( { startOnLoad: true, secure: \['parameter1', 'parameter2'] } );

Default values for the `secure array` consists of: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']. These default values are immutable.
Default values for the `secure array` consists of: \['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']. These default values are immutable.

Implementors can only modify configurations using directives, and cannot change the `secure` array.

# Modifying Configurations and directives:

The Two types of directives: are `init` (or `initialize`) and `wrap`.

```note
Expand All @@ -52,13 +54,13 @@ All directives are enclosed in `%%{ }%%`
Older versions of mermaid will not parse directives because `%%` will comment out the directive. This makes the update backwards-compatible.

# Init

`init`, or `initialize`: this directive gives the user the ability to overwrite and change the values for any configuration parameters not set in the secure array.

| Parameter | Description |Type | Required | Values|
| --- | --- | --- | --- | --- |
| init | modifies configurations| Directive| Optional | Any parameters not included in the secure array|


```note
init would be an argument-directive: `%%{init: { **insert argument here**}}%%`

Expand All @@ -73,6 +75,7 @@ When deployed within code, init is called before the graph/diagram description.
```

**for example**:

```mmd
%%{init: {"theme": "default", "logLevel": 1 }}%%
graph LR
Expand All @@ -84,6 +87,7 @@ When deployed within code, init is called before the graph/diagram description.
f-->g
g-->
```

# Wrap

| Parameter | Description |Type | Required | Values|
Expand All @@ -104,8 +108,8 @@ It is a non-argument directive and can be executed thusly:

![Image showing wrapped text](img/wrapped%20text.png)


# Resetting Configurations:

There are two more functions in the mermaidAPI that can be called by site owners: **reset** and **globalReset**.

**reset**: resets the configuration to whatever the last configuration was. This can be done to undo more recent changes set from the last mermaidAPI.initialize({...}) configuration.
Expand All @@ -115,6 +119,7 @@ There are two more functions in the mermaidAPI that can be called by site owners
**Notes**: Both `reset` and `globalReset` are only available to site owners, and as such implementors have to edit their configs using `init`.

# Additional Utils to mermaid

• **memoize**: simple caching for computationally expensive functions, reducing rendering time by about 90%.

• **assignWithDepth** - an improvement on previous functions with config.js and `Object.assign`. The purpose of this function is to provide a sane mechanism for merging objects, similar to `object.assign`, but with depth.
Expand All @@ -123,7 +128,6 @@ Example of **assignWithDepth**:

![Image showing assignWithDepth](img/assignWithDepth.png)


Example of **object.Assign**:

![Image showing object.assign without depth](img/object.assign%20without%20depth.png)
Expand All @@ -132,7 +136,6 @@ Example of **object.Assign**:

**Notes**: For more information on usage, parameters, and return info for these new functions take a look at the jsdocs for them in the utils package.


# New API Requests Introduced in Version 8.6.0

## setSiteConfig
Expand Down Expand Up @@ -177,7 +180,6 @@ siteConfig value.
| --------- | ------------------- | ------- | ------------------ |
| `getConfig` |Obtains the `currentConfig` | Get Request | Any Values from `currentConfig`|


```note
Returns any values in currentConfig.
```
Expand Down
Loading