Skip to content

Commit

Permalink
fix(deps): upgrade to marked v12 (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Jun 2, 2024
1 parent 7817e83 commit 862d89e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
21 changes: 4 additions & 17 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"gaxios": "^6.0.0",
"glob": "^10.3.10",
"htmlparser2": "^9.0.0",
"marked": "^10.0.0",
"marked": "^12.0.1",
"meow": "^13.0.0",
"mime": "^4.0.0",
"server-destroy": "^1.0.1",
Expand Down
11 changes: 10 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ async function handleRequest(
let mimeType = mime.getType(localPath);
const isMarkdown = request.url?.toLocaleLowerCase().endsWith('.md');
if (isMarkdown && options.markdown) {
data = marked(data, {gfm: true});
const markedData = marked(data, {gfm: true});
if (typeof markedData === 'string') {
data = markedData;
} else if (
(typeof markedData === 'object' || typeof markedData === 'function') &&
typeof markedData.then === 'function'
) {
data = await markedData;
}

mimeType = 'text/html; charset=UTF-8';
}

Expand Down

0 comments on commit 862d89e

Please sign in to comment.