prevent front-matter render on markdown

This commit is contained in:
btzr-io 2020-12-17 16:44:16 -06:00 committed by Sean Yesmunt
parent 49abbecbd7
commit 35653bb115
3 changed files with 24 additions and 1 deletions

View file

@ -183,6 +183,7 @@
"remark": "^9.0.0", "remark": "^9.0.0",
"remark-attr": "^0.8.3", "remark-attr": "^0.8.3",
"remark-emoji": "^2.0.1", "remark-emoji": "^2.0.1",
"remark-frontmatter": "^2.0.0",
"remark-react": "^4.0.3", "remark-react": "^4.0.3",
"reselect": "^3.0.0", "reselect": "^3.0.0",
"sass": "^1.29.0", "sass": "^1.29.0",

View file

@ -6,6 +6,7 @@ import remarkAttr from 'remark-attr';
import remarkStrip from 'strip-markdown'; import remarkStrip from 'strip-markdown';
import remarkEmoji from 'remark-emoji'; import remarkEmoji from 'remark-emoji';
import remarkBreaks from 'remark-breaks'; import remarkBreaks from 'remark-breaks';
import remarkFrontMatter from 'remark-frontmatter';
import reactRenderer from 'remark-react'; import reactRenderer from 'remark-react';
import MarkdownLink from 'component/markdownLink'; import MarkdownLink from 'component/markdownLink';
import defaultSchema from 'hast-util-sanitize/lib/github.json'; import defaultSchema from 'hast-util-sanitize/lib/github.json';
@ -120,7 +121,7 @@ const MarkdownPreview = (props: MarkdownProps) => {
const remarkAttrOpts = { const remarkAttrOpts = {
scope: 'extended', scope: 'extended',
elements: ['link'], elements: ['link', 'yaml'],
extend: { link: ['embed'] }, extend: { link: ['embed'] },
defaultValue: true, defaultValue: true,
}; };
@ -134,6 +135,7 @@ const MarkdownPreview = (props: MarkdownProps) => {
{ {
remark() remark()
.use(remarkStrip) .use(remarkStrip)
.use(remarkFrontMatter, ['yaml'])
.use(reactRenderer, remarkOptions) .use(reactRenderer, remarkOptions)
.processSync(content).contents .processSync(content).contents
} }
@ -156,6 +158,7 @@ const MarkdownPreview = (props: MarkdownProps) => {
.use(remarkEmoji) .use(remarkEmoji)
// Render new lines without needing spaces. // Render new lines without needing spaces.
.use(remarkBreaks) .use(remarkBreaks)
.use(remarkFrontMatter, ['yaml'])
.use(reactRenderer, remarkOptions) .use(reactRenderer, remarkOptions)
.processSync(strippedContent).contents .processSync(strippedContent).contents
} }

View file

@ -5431,6 +5431,13 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6:
version "2.0.6" version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
fault@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13"
integrity sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==
dependencies:
format "^0.2.0"
faye-websocket@^0.10.0: faye-websocket@^0.10.0:
version "0.10.0" version "0.10.0"
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4"
@ -5689,6 +5696,11 @@ for-in@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
format@^0.2.0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=
formik@^0.10.4: formik@^0.10.4:
version "0.10.5" version "0.10.5"
resolved "https://registry.yarnpkg.com/formik/-/formik-0.10.5.tgz#6984d2f22e918c6d2264a3cb86b8582f7277faca" resolved "https://registry.yarnpkg.com/formik/-/formik-0.10.5.tgz#6984d2f22e918c6d2264a3cb86b8582f7277faca"
@ -10033,6 +10045,13 @@ remark-emoji@^2.0.1:
node-emoji "^1.8.1" node-emoji "^1.8.1"
unist-util-visit "^1.4.0" unist-util-visit "^1.4.0"
remark-frontmatter@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/remark-frontmatter/-/remark-frontmatter-2.0.0.tgz#c9b8539c27cd23b1672c7e0fcbd5795eeedb4dc1"
integrity sha512-uNOQt4tO14qBFWXenF0MLC4cqo3dv8qiHPGyjCl1rwOT0LomSHpcElbjjVh5CwzElInB38HD8aSRVugKQjeyHA==
dependencies:
fault "^1.0.1"
remark-parse@^5.0.0: remark-parse@^5.0.0:
version "5.0.0" version "5.0.0"
resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95"