-
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.
Merge pull request #1 from danielsitnik/develop
Develop
- Loading branch information
Showing
12 changed files
with
5,446 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This workflow will run tests using node and then publish a package to NPM when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12.x | ||
- run: npm ci | ||
# - run: npm test | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12.x | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_auth_token}} |
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 |
---|---|---|
|
@@ -102,3 +102,6 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Webstorm | ||
.idea |
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,2 +1,80 @@ | ||
# codedoc-mermaid-plugin | ||
Mermaid plugin for Codedoc | ||
This plugin enables the use of [Mermaid](https://mermaid-js.github.io) diagrams in [Codedoc](https://codedoc.cc) documents. | ||
|
||
## Installation | ||
Using the Codedoc CLI, run the following command inside your project's folder: | ||
```bash | ||
$ codedoc install codedoc-mermaid-plugin | ||
``` | ||
|
||
## Configuration | ||
To use the plugin, first edit your `config.ts` file like below. | ||
Make sure you import the plugin at the top of the file, and then add it to the `plugins` section in the `configuration` function. | ||
|
||
```ts | ||
import { configuration } from '@codedoc/core'; | ||
import { mermaidPlugin } from 'codedoc-mermaid-plugin' // --> import the plugin | ||
import { theme } from './theme'; | ||
|
||
export const config = /*#__PURE__*/configuration({ | ||
theme, | ||
page: { | ||
title: { | ||
base: 'Mermaid Plugin' | ||
} | ||
}, | ||
plugins: [ | ||
mermaidPlugin() // --> make sure you add this section | ||
] | ||
}); | ||
``` | ||
|
||
### Customizing Configuration | ||
Mermaid's configuration can be changed by passing a `MermaidOptions` object to the `mermaidPlugin()` function. | ||
Basically all the options described [here](https://mermaid-js.github.io/mermaid/#/Setup) are supported. | ||
|
||
For example, if you wanted to change the theme to `neutral` and to change the spacing between flowchart nodes, you would do this: | ||
```ts | ||
// imports removed for brevity | ||
export const config = /*#__PURE__*/configuration({ | ||
theme, | ||
page: { | ||
title: { | ||
base: 'Mermaid Plugin' | ||
} | ||
}, | ||
plugins: [ | ||
mermaidPlugin({ | ||
theme: "neutral", | ||
flowchart: { | ||
nodeSpacing: 75 | ||
} | ||
}) | ||
] | ||
}); | ||
``` | ||
|
||
## Usage | ||
To render diagrams in your documents, all you need to do is wrap Mermaid's diagram syntax in markdown `block-quote` elements (Codedoc calls them "quoted components") like below: | ||
```md | ||
> :Mermaid | ||
> > graph LR | ||
> > Start --> End | ||
``` | ||
|
||
Another way to do it is with just one `>` sign, but you **must** add a blank line below `:Mermaid`: | ||
```md | ||
> :Mermaid | ||
> | ||
> graph LR | ||
> Start --> End | ||
``` | ||
Refer to the "Diagram Syntax" section of Mermaid's [documentation](https://mermaid-js.github.io) to learn how to use each of the diagrams. | ||
|
||
## Contributing | ||
If you'd like to contribute to this plugin, here are some ideas for improvements: | ||
1. Add some styling so the diagrams can be rendered inside some container, similar to the code blocks. | ||
2. Find a way to dynamically change the theme when switching between light/dark mode. Right now the `neutral` theme is the one that works best with both modes. | ||
|
||
## License | ||
[MIT](https://choosealicense.com/licenses/mit/) |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
"declaration": true, | ||
"sourceMap": true, | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"jsx": "react", | ||
"jsxFactory": "renderer.create", | ||
"lib": [ | ||
"es2017", | ||
"dom" | ||
] | ||
}, | ||
"include": [ | ||
"../../src/**/*" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./base", | ||
"compilerOptions": { | ||
"target": "es5", | ||
"outDir": "../../dist/es5/" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./base", | ||
"compilerOptions": { | ||
"inlineSources": true, | ||
"target": "es6", | ||
"outDir": "../../dist/es6/" | ||
} | ||
} |
Oops, something went wrong.