fix frontmatter parse flag

This commit is contained in:
James Brumond 2023-05-07 17:19:55 -07:00
parent b2de8df538
commit 715451f02f
Signed by: james
GPG Key ID: E8F2FC44BAA3357A
2 changed files with 22 additions and 19 deletions

39
package-lock.json generated
View File

@ -1,10 +1,12 @@
{ {
"name": "markdown-to-html", "name": "@doc-utils/markdown2html",
"version": "0.1.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "markdown-to-html", "name": "@doc-utils/markdown2html",
"version": "0.1.7",
"dependencies": { "dependencies": {
"bytefield-svg": "^1.6.1", "bytefield-svg": "^1.6.1",
"dompurify": "^2.3.6", "dompurify": "^2.3.6",
@ -18,6 +20,9 @@
"vega": "^5.22.1", "vega": "^5.22.1",
"yaml": "^2.2.2" "yaml": "^2.2.2"
}, },
"bin": {
"markdown2html": "bin/markdown2html"
},
"devDependencies": { "devDependencies": {
"@types/dompurify": "^2.3.3", "@types/dompurify": "^2.3.3",
"@types/jsdom": "^20.0.0", "@types/jsdom": "^20.0.0",
@ -28,8 +33,7 @@
"@types/prismjs": "^1.26.0", "@types/prismjs": "^1.26.0",
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.0",
"typescript": "^5.0.4" "typescript": "^5.0.4"
}, }
"version": "0.1.7"
}, },
"node_modules/@tootallnate/once": { "node_modules/@tootallnate/once": {
"version": "2.0.0", "version": "2.0.0",
@ -82,15 +86,15 @@
"dev": true "dev": true
}, },
"node_modules/@types/marked": { "node_modules/@types/marked": {
"version": "4.0.8", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.0.8.tgz", "resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.3.0.tgz",
"integrity": "sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==", "integrity": "sha512-zK4gSFMjgslsv5Lyvr3O1yCjgmnE4pr8jbG8qVn4QglMwtpvPCf4YT2Wma7Nk95OxUUJI8Z+kzdXohbM7mVpGw==",
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.16.3", "version": "18.16.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.5.tgz",
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", "integrity": "sha512-seOA34WMo9KB+UA78qaJoCO20RJzZGVXQ5Sh6FWu0g/hfT44nKXnej3/tCQl7FL97idFpBhisLYCTB50S0EirA==",
"dev": true "dev": true
}, },
"node_modules/@types/prismjs": { "node_modules/@types/prismjs": {
@ -2011,15 +2015,15 @@
"dev": true "dev": true
}, },
"@types/marked": { "@types/marked": {
"version": "4.0.8", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.0.8.tgz", "resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.3.0.tgz",
"integrity": "sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==", "integrity": "sha512-zK4gSFMjgslsv5Lyvr3O1yCjgmnE4pr8jbG8qVn4QglMwtpvPCf4YT2Wma7Nk95OxUUJI8Z+kzdXohbM7mVpGw==",
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "18.16.3", "version": "18.16.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.5.tgz",
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", "integrity": "sha512-seOA34WMo9KB+UA78qaJoCO20RJzZGVXQ5Sh6FWu0g/hfT44nKXnej3/tCQl7FL97idFpBhisLYCTB50S0EirA==",
"dev": true "dev": true
}, },
"@types/prismjs": { "@types/prismjs": {
@ -3482,6 +3486,5 @@
"decamelize": "^1.2.0" "decamelize": "^1.2.0"
} }
} }
}, }
"version": "0.1.7"
} }

View File

@ -20,7 +20,7 @@ export function process_frontmatter(raw_document: string, parse = true) {
const formatter_yaml = raw_document.slice(3, end_index); const formatter_yaml = raw_document.slice(3, end_index);
const document = raw_document.slice(end_index + 4); const document = raw_document.slice(end_index + 4);
const frontmatter = parse ? formatter_yaml : yaml.parse(formatter_yaml); const frontmatter = parse ? yaml.parse(formatter_yaml) : formatter_yaml;
return { frontmatter, document }; return { frontmatter, document };
} }