Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mishig25 committed Oct 18, 2023
1 parent 67efbb5 commit f66196d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kit/preprocessors/mdsvex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,14 @@ function treeVisitor() {
visit(tree, "text", onText);
visit(tree, "html", onHtml);

let jsonString = JSON.stringify(headings[0]);
if (jsonString) {
jsonString = jsonString.replaceAll("'", "\\'");
}

tree.children.unshift({
type: "html",
value: `<script context="module">export const metadata = '${JSON.stringify(
headings[0]
)}';</script>`,
value: `<script context="module">export const metadata = '${jsonString}';</script>`,
});
}

Expand Down

0 comments on commit f66196d

Please sign in to comment.