fix(core): update

This commit is contained in:
Philipp Kunz 2021-10-04 13:54:59 +02:00
parent 6bd015e5bb
commit 75c62c01f5
4 changed files with 108 additions and 2 deletions

100
package-lock.json generated
View File

@ -11,6 +11,7 @@
"dependencies": {
"@types/turndown": "^5.0.1",
"remark": "^13.0.0",
"remark-frontmatter": "^3.0.0",
"remark-html": "^13.0.0",
"turndown": "^7.1.1",
"turndown-plugin-gfm": "^1.0.2"
@ -7166,6 +7167,19 @@
"dev": true,
"license": "MIT"
},
"node_modules/fault": {
"version": "1.0.4",
"resolved": "https://verdaccio.lossless.one/fault/-/fault-1.0.4.tgz",
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
"license": "MIT",
"dependencies": {
"format": "^0.2.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/fd-slicer": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/fd-slicer/-/fd-slicer-1.1.0.tgz",
@ -7375,6 +7389,14 @@
"node": ">= 6"
}
},
"node_modules/format": {
"version": "0.2.2",
"resolved": "https://verdaccio.lossless.one/format/-/format-0.2.2.tgz",
"integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=",
"engines": {
"node": ">=0.4.x"
}
},
"node_modules/forwarded": {
"version": "0.1.2",
"resolved": "https://verdaccio.lossless.one/forwarded/-/forwarded-0.1.2.tgz",
@ -9727,6 +9749,19 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/mdast-util-frontmatter": {
"version": "0.2.0",
"resolved": "https://verdaccio.lossless.one/mdast-util-frontmatter/-/mdast-util-frontmatter-0.2.0.tgz",
"integrity": "sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==",
"license": "MIT",
"dependencies": {
"micromark-extension-frontmatter": "^0.2.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/mdast-util-to-hast": {
"version": "10.2.0",
"resolved": "https://verdaccio.lossless.one/mdast-util-to-hast/-/mdast-util-to-hast-10.2.0.tgz",
@ -9862,6 +9897,19 @@
"parse-entities": "^2.0.0"
}
},
"node_modules/micromark-extension-frontmatter": {
"version": "0.2.2",
"resolved": "https://verdaccio.lossless.one/micromark-extension-frontmatter/-/micromark-extension-frontmatter-0.2.2.tgz",
"integrity": "sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==",
"license": "MIT",
"dependencies": {
"fault": "^1.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/micromatch": {
"version": "3.1.10",
"resolved": "https://verdaccio.lossless.one/micromatch/-/micromatch-3.1.10.tgz",
@ -12764,6 +12812,20 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/remark-frontmatter": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/remark-frontmatter/-/remark-frontmatter-3.0.0.tgz",
"integrity": "sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==",
"license": "MIT",
"dependencies": {
"mdast-util-frontmatter": "^0.2.0",
"micromark-extension-frontmatter": "^0.2.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/remark-html": {
"version": "13.0.2",
"resolved": "https://verdaccio.lossless.one/remark-html/-/remark-html-13.0.2.tgz",
@ -21452,6 +21514,14 @@
"integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==",
"dev": true
},
"fault": {
"version": "1.0.4",
"resolved": "https://verdaccio.lossless.one/fault/-/fault-1.0.4.tgz",
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
"requires": {
"format": "^0.2.0"
}
},
"fd-slicer": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/fd-slicer/-/fd-slicer-1.1.0.tgz",
@ -21613,6 +21683,11 @@
"mime-types": "^2.1.12"
}
},
"format": {
"version": "0.2.2",
"resolved": "https://verdaccio.lossless.one/format/-/format-0.2.2.tgz",
"integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs="
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://verdaccio.lossless.one/forwarded/-/forwarded-0.1.2.tgz",
@ -23301,6 +23376,14 @@
"unist-util-stringify-position": "^2.0.0"
}
},
"mdast-util-frontmatter": {
"version": "0.2.0",
"resolved": "https://verdaccio.lossless.one/mdast-util-frontmatter/-/mdast-util-frontmatter-0.2.0.tgz",
"integrity": "sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==",
"requires": {
"micromark-extension-frontmatter": "^0.2.0"
}
},
"mdast-util-to-hast": {
"version": "10.2.0",
"resolved": "https://verdaccio.lossless.one/mdast-util-to-hast/-/mdast-util-to-hast-10.2.0.tgz",
@ -23393,6 +23476,14 @@
"parse-entities": "^2.0.0"
}
},
"micromark-extension-frontmatter": {
"version": "0.2.2",
"resolved": "https://verdaccio.lossless.one/micromark-extension-frontmatter/-/micromark-extension-frontmatter-0.2.2.tgz",
"integrity": "sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==",
"requires": {
"fault": "^1.0.0"
}
},
"micromatch": {
"version": "3.1.10",
"resolved": "https://verdaccio.lossless.one/micromatch/-/micromatch-3.1.10.tgz",
@ -25589,6 +25680,15 @@
"unified": "^9.1.0"
}
},
"remark-frontmatter": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/remark-frontmatter/-/remark-frontmatter-3.0.0.tgz",
"integrity": "sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==",
"requires": {
"mdast-util-frontmatter": "^0.2.0",
"micromark-extension-frontmatter": "^0.2.0"
}
},
"remark-html": {
"version": "13.0.2",
"resolved": "https://verdaccio.lossless.one/remark-html/-/remark-html-13.0.2.tgz",

View File

@ -23,6 +23,7 @@
"dependencies": {
"@types/turndown": "^5.0.1",
"remark": "^13.0.0",
"remark-frontmatter": "^3.0.0",
"remark-html": "^13.0.0",
"turndown": "^7.1.1",
"turndown-plugin-gfm": "^1.0.2"

View File

@ -8,7 +8,11 @@ export class SmartMarkdown {
* @param mdString
*/
public async markdownToHtml(mdString: string): Promise<string> {
const result = await plugins.remark().use(plugins.remarkHtml).process(mdString);
const result = await plugins
.remark()
.use(plugins.remarkHtml)
.use(plugins.remarkFrontmatter, ['yaml', 'toml'])
.process(mdString);
return result.toString();
}

View File

@ -1,8 +1,9 @@
// third party remark
import remark from 'remark';
import remarkFrontmatter from 'remark-frontmatter';
import remarkHtml from 'remark-html';
export { remark, remarkHtml };
export { remark, remarkFrontmatter, remarkHtml };
// other third party stuff
import turndown from 'turndown';