From 75c62c01f57b0903aafe342b5bde3091722a219f Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 4 Oct 2021 13:54:59 +0200 Subject: [PATCH] fix(core): update --- package-lock.json | 100 ++++++++++++++++++++++++++++++++++++ package.json | 1 + ts/index.ts | 6 ++- ts/smartmarkdown.plugins.ts | 3 +- 4 files changed, 108 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1319ba8..bd8efc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index db76a76..0e79989 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/ts/index.ts b/ts/index.ts index 1c277cc..d1615b5 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -8,7 +8,11 @@ export class SmartMarkdown { * @param mdString */ public async markdownToHtml(mdString: string): Promise { - 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(); } diff --git a/ts/smartmarkdown.plugins.ts b/ts/smartmarkdown.plugins.ts index 160804c..0f23ef5 100644 --- a/ts/smartmarkdown.plugins.ts +++ b/ts/smartmarkdown.plugins.ts @@ -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';