Skip to content

Commit

Permalink
Rename to rehype-mermaid
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Oct 20, 2023
1 parent 2fd0da0 commit 3bef767
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# rehype-mermaidjs
# rehype-mermaid

[![github actions](https://github.com/remcohaszing/rehype-mermaidjs/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/rehype-mermaidjs/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/remcohaszing/rehype-mermaidjs/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/rehype-mermaidjs)
[![npm version](https://img.shields.io/npm/v/rehype-mermaidjs)](https://www.npmjs.com/package/rehype-mermaidjs)
[![npm downloads](https://img.shields.io/npm/dm/rehype-mermaidjs)](https://www.npmjs.com/package/rehype-mermaidjs)
[![github actions](https://github.com/remcohaszing/rehype-mermaid/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/rehype-mermaid/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/remcohaszing/rehype-mermaid/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/rehype-mermaid)
[![npm version](https://img.shields.io/npm/v/rehype-mermaid)](https://www.npmjs.com/package/rehype-mermaid)
[![npm downloads](https://img.shields.io/npm/dm/rehype-mermaid)](https://www.npmjs.com/package/rehype-mermaid)

A [rehype](https://rehype.js.org) plugin to render [mermaid](https://mermaid-js.github.io) diagrams.

Expand All @@ -28,12 +28,13 @@ A [rehype](https://rehype.js.org) plugin to render [mermaid](https://mermaid-js.
- [Compatibility](#compatibility)
- [Related Projects](#related-projects)
- [Contributing](#contributing)
- [Acknowledgements](#acknowledgements)
- [License](#license)

## Installation

```sh
npm install rehype-mermaidjs
npm install rehype-mermaid
```

In Node.js this package uses [playwright](https://playwright.dev) under the hood. To use it, you may
Expand Down Expand Up @@ -88,7 +89,7 @@ The following script:
import { readFile } from 'node:fs/promises'

import { rehype } from 'rehype'
import rehypeMermaid from 'rehype-mermaidjs'
import rehypeMermaid from 'rehype-mermaid'

const { value } = await rehype()
.use(rehypeMermaid, {
Expand Down Expand Up @@ -267,6 +268,10 @@ slightly different results. Don’t worry about adding new fixtures, but don’t
that cause CI to fail. Furthermore see my global
[contributing guidelines](https://github.com/remcohaszing/.github/blob/main/CONTRIBUTING.md).

## Acknowledgements

Thanks to [@bitekong](https://github.com/bitekong) for giving me the npm package name.

## License

[MIT](LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ const rehypeMermaid: Plugin<[RehypeMermaidOptions?], Root> = (options) => {
replacement = options.errorFallback(node, diagram, result.reason, file)
} else {
const message = file.message(result.reason, {
ruleId: 'rehype-mermaidjs',
source: 'rehype-mermaidjs',
ruleId: 'rehype-mermaid',
source: 'rehype-mermaid',
ancestors
})
message.fatal = true
message.url = 'https://github.com/remcohaszing/rehype-mermaidjs'
message.url = 'https://github.com/remcohaszing/rehype-mermaid'
throw message
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rehype-mermaidjs",
"name": "rehype-mermaid",
"version": "2.0.0",
"description": "A rehype plugin to render mermaid diagrams",
"exports": "./index.js",
Expand All @@ -14,9 +14,9 @@
},
"author": "Remco Haszing <remcohaszing@gmail.com>",
"license": "MIT",
"repository": "remcohaszing/rehype-mermaidjs",
"bugs": "https://github.com/remcohaszing/rehype-mermaidjs/issues",
"homepage": "https://github.com/remcohaszing/rehype-mermaidjs#readme",
"repository": "remcohaszing/rehype-mermaid",
"bugs": "https://github.com/remcohaszing/rehype-mermaid/issues",
"homepage": "https://github.com/remcohaszing/rehype-mermaid#readme",
"funding": "https://github.com/sponsors/remcohaszing",
"keywords": [
"documentation",
Expand Down
6 changes: 3 additions & 3 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ test('invalid diagram unhandled', async () => {
() => processor.process('<pre class="mermaid">This is not a valid diagram</pre>'),
(error) => {
assert(error instanceof VFileMessage)
assert.equal(error.source, 'rehype-mermaidjs')
assert.equal(error.ruleId, 'rehype-mermaidjs')
assert.equal(error.source, 'rehype-mermaid')
assert.equal(error.ruleId, 'rehype-mermaid')
assert.equal(
error.reason,
'No diagram type detected matching given configuration for text: This is not a valid diagram'
Expand All @@ -116,7 +116,7 @@ test('invalid diagram unhandled', async () => {
start: { line: 1, column: 1, offset: 0 },
end: { line: 1, column: 55, offset: 54 }
})
assert.equal(error.url, 'https://github.com/remcohaszing/rehype-mermaidjs')
assert.equal(error.url, 'https://github.com/remcohaszing/rehype-mermaid')
const root = error.ancestors![0] as Root
const html = root.children[0] as Element
const body = html.children[1] as Element
Expand Down

0 comments on commit 3bef767

Please sign in to comment.