summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src
diff options
context:
space:
mode:
authorGravatar Jonathan Neal <jonathantneal@hotmail.com> 2021-12-13 16:18:21 -0500
committerGravatar GitHub <noreply@github.com> 2021-12-13 16:18:21 -0500
commit6570a204428c11ff233be3ceb7554214a678a6bc (patch)
tree26b667c7091027696f5bed0966bd60dee7350086 /packages/markdown/remark/src
parent5f5dc60976254750e1c51c15ce6327adbd5a21ab (diff)
downloadastro-6570a204428c11ff233be3ceb7554214a678a6bc.tar.gz
astro-6570a204428c11ff233be3ceb7554214a678a6bc.tar.zst
astro-6570a204428c11ff233be3ceb7554214a678a6bc.zip
rebase (#2087)
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r--packages/markdown/remark/src/rehype-islands.ts6
-rw-r--r--packages/markdown/remark/src/remark-unwrap.ts6
2 files changed, 10 insertions, 2 deletions
diff --git a/packages/markdown/remark/src/rehype-islands.ts b/packages/markdown/remark/src/rehype-islands.ts
index b98419cd4..e3fa09860 100644
--- a/packages/markdown/remark/src/rehype-islands.ts
+++ b/packages/markdown/remark/src/rehype-islands.ts
@@ -1,4 +1,8 @@
-import { SKIP, visit } from 'unist-util-visit';
+import { SKIP, visit as _visit } from 'unist-util-visit';
+
+// This is a workaround.
+// It fixes a compatibility issue between different, incompatible ASTs given by plugins to Unist
+const visit = _visit as (node: any, type: string, callback?: (node: any, index: number, parent: any) => any) => any;
// This fixes some confusing bugs coming from somewhere inside of our Markdown pipeline.
// `unist`/`remark`/`rehype` (not sure) often generate malformed HTML inside of <astro-root>
diff --git a/packages/markdown/remark/src/remark-unwrap.ts b/packages/markdown/remark/src/remark-unwrap.ts
index d6f3275ab..15ddb7779 100644
--- a/packages/markdown/remark/src/remark-unwrap.ts
+++ b/packages/markdown/remark/src/remark-unwrap.ts
@@ -1,4 +1,8 @@
-import { visit, SKIP } from 'unist-util-visit';
+import { visit as _visit, SKIP } from 'unist-util-visit';
+
+// This is a workaround.
+// It fixes a compatibility issue between different, incompatible ASTs given by plugins to Unist
+const visit = _visit as (node: any, type: string, callback?: (node: any, index: number, parent: any) => any) => any;
// Remove the wrapping paragraph for <astro-root> islands
export default function remarkUnwrap() {