From c383a45b75685204a1804ea4361d08d19bbeb1cf Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 25 Sep 2023 20:06:59 +0200 Subject: [PATCH] Update `@types/hast`, utilities, plugins, etc --- lib/ast-to-react.js | 2 +- package.json | 24 ++++++++++++------------ test/fixtures/runthrough.html | 8 ++++---- test/fixtures/runthrough.md | 2 +- test/test.jsx | 5 +++-- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/ast-to-react.js b/lib/ast-to-react.js index ef02544e..d32c06b0 100644 --- a/lib/ast-to-react.js +++ b/lib/ast-to-react.js @@ -16,7 +16,7 @@ * @typedef {import('hast').Root} Root * @typedef {import('hast').Text} Text * @typedef {import('hast').Comment} Comment - * @typedef {import('hast').DocType} Doctype + * @typedef {import('hast').Doctype} Doctype * @typedef {import('property-information').Info} Info * @typedef {import('property-information').Schema} Schema * @typedef {import('./complex-types.js').ReactMarkdownProps} ReactMarkdownProps diff --git a/package.json b/package.json index 150a2367..6f0526c5 100644 --- a/package.json +++ b/package.json @@ -79,21 +79,21 @@ "react-markdown.min.js" ], "dependencies": { - "@types/hast": "^2.0.0", + "@types/hast": "^3.0.0", "@types/prop-types": "^15.0.0", - "@types/unist": "^2.0.0", + "@types/unist": "^3.0.0", "comma-separated-tokens": "^2.0.0", - "hast-util-whitespace": "^2.0.0", + "hast-util-whitespace": "^3.0.0", "prop-types": "^15.0.0", "property-information": "^6.0.0", "react-is": "^18.0.0", - "remark-parse": "^10.0.0", - "remark-rehype": "^10.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", "space-separated-tokens": "^2.0.0", "style-to-object": "^0.4.0", - "unified": "^10.0.0", - "unist-util-visit": "^4.0.0", - "vfile": "^5.0.0" + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" }, "peerDependencies": { "@types/react": ">=16", @@ -114,11 +114,11 @@ "prettier": "^3.0.0", "react": "^18.0.0", "react-dom": "^18.0.0", - "rehype-raw": "^6.0.0", + "rehype-raw": "^7.0.0", "remark-cli": "^11.0.0", - "remark-gfm": "^3.0.0", + "remark-gfm": "^4.0.0", "remark-preset-wooorm": "^9.0.0", - "remark-toc": "^8.0.0", + "remark-toc": "^9.0.0", "type-coverage": "^2.0.0", "typescript": "^5.0.0", "xo": "^0.56.0" @@ -143,7 +143,7 @@ "plugins": [ "remark-preset-wooorm", [ - "remark-gfm", + "./node_modules/remark-preset-wooorm/node_modules/remark-gfm/index.js", { "tablePipeAlign": false } diff --git a/test/fixtures/runthrough.html b/test/fixtures/runthrough.html index 8dd0c334..824af77d 100644 --- a/test/fixtures/runthrough.html +++ b/test/fixtures/runthrough.html @@ -152,10 +152,10 @@

HTML entities

Some characters, like æ, & and similar should be handled properly.

HTML

Does anyone actually like the fact that you can embed HTML in markdown?

-, as long as it doesn't contain any attributes. If you + +

We used to have a known bug where inline HTML wasn't handled well. You can do basic tags like +code, as long as it doesn't contain any attributes. If you have weird ordering on your tags, it won't work either. It does support nested -tags, however. And with the rehype-raw plugin, it can now properly handle HTML! Which is pretty sweet.

+tags, however. And with the rehype-raw plugin, it can now properly handle HTML! Which is pretty sweet.



Cool, eh?

\ No newline at end of file diff --git a/test/fixtures/runthrough.md b/test/fixtures/runthrough.md index c643ab4c..7fec387f 100644 --- a/test/fixtures/runthrough.md +++ b/test/fixtures/runthrough.md @@ -159,7 +159,7 @@ Does anyone actually like the fact that you can embed HTML in markdown? src="https://foo.bar/" width="640" height="480" -/> +> We used to have a known bug where inline HTML wasn't handled well. You can do basic tags like code, as long as it doesn't contain any attributes. If you diff --git a/test/test.jsx b/test/test.jsx index ed0418f3..b21bfb7a 100644 --- a/test/test.jsx +++ b/test/test.jsx @@ -835,7 +835,7 @@ test('should render footnote with custom options', () => { remarkRehypeOptions={{clobberPrefix: 'main-'}} /> ), - '

This is a statement1 with a citation.

\n

Footnotes

\n
    \n
  1. \n

    This is a footnote for the citation.

    \n
  2. \n
\n
' + '

This is a statement1 with a citation.

\n

Footnotes

\n
    \n
  1. \n

    This is a footnote for the citation.

    \n
  2. \n
\n
' ) }) @@ -1155,9 +1155,10 @@ test('should render table of contents plugin', () => { const actual = asHtml( ) + assert.equal( actual, - '

Header

\n

Table of Contents

\n\n

First Section

\n

Second Section

\n

Subsection

\n

Third Section

' + '

Header

\n

Table of Contents

\n\n

First Section

\n

Second Section

\n

Subsection

\n

Third Section

' ) })