Update things

Fix highlight.js deprecation warning
Fix plaintext markdown code blocks not working
This commit is contained in:
Shadowfacts 2021-04-16 18:36:41 -04:00
parent 9296bb1ddc
commit 2c40d891b1
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 920 additions and 4309 deletions

View File

@ -44,7 +44,7 @@ export default function comments(router: Router) {
}); });
router.get("/comments", async (req, res) => { router.get("/comments", async (req, res) => {
const id = req.query.id; const id = req.query.id as string;
if (!id) { if (!id) {
res.sendStatus(400).end(); res.sendStatus(400).end();
return; return;

View File

@ -23,7 +23,7 @@ export function getReadingTime(words: number): number {
} }
export function highlight(source: string, language?: string): string { 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; const highlighted = res.value;
return `<pre class="hljs"><code>${highlighted}</code></pre>`; return `<pre class="hljs"><code>${highlighted}</code></pre>`;
} }

5212
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,8 @@
"@types/express": "^4.16.1", "@types/express": "^4.16.1",
"@types/markdown-it": "0.0.7", "@types/markdown-it": "0.0.7",
"@types/morgan": "^1.7.35", "@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/request": "^2.48.1",
"@types/sanitize-html": "^1.18.2", "@types/sanitize-html": "^1.18.2",
"@types/sass": "^1.16.0", "@types/sass": "^1.16.0",
@ -24,21 +25,21 @@
"date-fns": "^1.30.1", "date-fns": "^1.30.1",
"ejs": "^2.6.1", "ejs": "^2.6.1",
"express": "^4.16.4", "express": "^4.16.4",
"highlight.js": "^10.5.0", "highlight.js": "^10.7.2",
"markdown-it": "^8.4.2", "markdown-it": "^8.4.2",
"markdown-it-footnote": "^3.0.2", "markdown-it-footnote": "^3.0.2",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"node-sass": "^4.13.1", "node-sass": "^5.0.0",
"pg": "^8.5.1", "pg": "^8.5.1",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"request": "^2.88.0", "request": "^2.88.0",
"sanitize-html": "^1.20.0", "sanitize-html": "^1.20.0",
"sass": "^1.26.9", "sass": "^1.26.9",
"typeorm": "^0.2.25", "typeorm": "^0.2.32",
"typescript": "^3.5.2", "typescript": "^4.2.4",
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
"devDependencies": { "devDependencies": {
"ts-node": "^8.3.0" "ts-node": "^9.1.1"
} }
} }