Skip to content

Commit

Permalink
Merge branch 'update-unist-util-visit'
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisklink committed Aug 25, 2022
2 parents 6105b42 + c4e5c0d commit a87fdeb
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 241 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed some `mermaidCli` options being ignored in v2.0.2

### Dependencies

- Updated `unist-util-visit` from `^2.0.3` to `^4.0.0`

## [2.0.2] - 2022-08-23

### Fixed
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { readFile } = require("fs/promises");
const puppeteer = require("puppeteer");

const visit = require("unist-util-visit");

const { setSvgBbox, validSVG } = require("./src/svg.js");

const PLUGIN_NAME = "remark-mermaid-dataurl";
Expand Down Expand Up @@ -152,6 +150,9 @@ function remarkMermaid({ mermaidCli = {} } = {}) {
*/
return async function (tree, file) {
const promises = []; // keep track of promises since visit isn't async

// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { visit } = await import("unist-util-visit");
visit(tree, "code", (node, index, parent) => {
// If this codeblock is not mermaid, bail.
if (node.lang !== "mermaid") {
Expand Down
Loading

0 comments on commit a87fdeb

Please sign in to comment.