Update things
Fix highlight.js deprecation warning Fix plaintext markdown code blocks not working
This commit is contained in:
parent
9296bb1ddc
commit
2c40d891b1
|
@ -44,7 +44,7 @@ export default function comments(router: Router) {
|
|||
});
|
||||
|
||||
router.get("/comments", async (req, res) => {
|
||||
const id = req.query.id;
|
||||
const id = req.query.id as string;
|
||||
if (!id) {
|
||||
res.sendStatus(400).end();
|
||||
return;
|
||||
|
|
|
@ -23,7 +23,7 @@ export function getReadingTime(words: number): number {
|
|||
}
|
||||
|
||||
export function highlight(source: string, language?: string): string {
|
||||
const res = language ? hljs.highlight(language, source) : hljs.highlightAuto(source);
|
||||
const res = language ? hljs.highlight(source, {language}) : hljs.highlightAuto(source);
|
||||
const highlighted = res.value;
|
||||
return `<pre class="hljs"><code>${highlighted}</code></pre>`;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
|
@ -13,7 +13,8 @@
|
|||
"@types/express": "^4.16.1",
|
||||
"@types/markdown-it": "0.0.7",
|
||||
"@types/morgan": "^1.7.35",
|
||||
"@types/node-sass": "^3.10.32",
|
||||
"@types/node": "^14.14.41",
|
||||
"@types/node-sass": "^4.11.1",
|
||||
"@types/request": "^2.48.1",
|
||||
"@types/sanitize-html": "^1.18.2",
|
||||
"@types/sass": "^1.16.0",
|
||||
|
@ -24,21 +25,21 @@
|
|||
"date-fns": "^1.30.1",
|
||||
"ejs": "^2.6.1",
|
||||
"express": "^4.16.4",
|
||||
"highlight.js": "^10.5.0",
|
||||
"highlight.js": "^10.7.2",
|
||||
"markdown-it": "^8.4.2",
|
||||
"markdown-it-footnote": "^3.0.2",
|
||||
"morgan": "^1.9.1",
|
||||
"node-sass": "^4.13.1",
|
||||
"node-sass": "^5.0.0",
|
||||
"pg": "^8.5.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"request": "^2.88.0",
|
||||
"sanitize-html": "^1.20.0",
|
||||
"sass": "^1.26.9",
|
||||
"typeorm": "^0.2.25",
|
||||
"typescript": "^3.5.2",
|
||||
"typeorm": "^0.2.32",
|
||||
"typescript": "^4.2.4",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^8.3.0"
|
||||
"ts-node": "^9.1.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue