From e7ac3a7671e8c38286affacf9e6b5172a5c1c294 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Tue, 13 Jun 2017 15:30:11 -0400 Subject: [PATCH] switch remark options to use gfm, fences --- src/components/Widgets/MarkdownControl/RawEditor/index.js | 2 +- src/components/Widgets/MarkdownControl/VisualEditor/index.js | 4 +++- src/components/Widgets/MarkdownControl/VisualEditor/parser.js | 2 +- src/components/Widgets/MarkdownPreview/index.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Widgets/MarkdownControl/RawEditor/index.js b/src/components/Widgets/MarkdownControl/RawEditor/index.js index c83de244..18f1c794 100644 --- a/src/components/Widgets/MarkdownControl/RawEditor/index.js +++ b/src/components/Widgets/MarkdownControl/RawEditor/index.js @@ -31,7 +31,7 @@ function cleanupPaste(paste) { .use(rehypeSanitize) .use(rehypeReparse) .use(rehypeToRemark) - .use(remarkToMarkdown, { commonmark: true, footnotes: true, pedantic: true }) + .use(remarkToMarkdown, { fences: true, footnotes: true, pedantic: true }) .process(paste); } diff --git a/src/components/Widgets/MarkdownControl/VisualEditor/index.js b/src/components/Widgets/MarkdownControl/VisualEditor/index.js index 15265c1d..6585442b 100644 --- a/src/components/Widgets/MarkdownControl/VisualEditor/index.js +++ b/src/components/Widgets/MarkdownControl/VisualEditor/index.js @@ -150,10 +150,12 @@ export default class Editor extends Component { const { serializer } = this.state; const newState = this.view.state.applyAction(action); const md = serializer.serialize(newState.doc); + console.log(md); const processedMarkdown = unified() .use(markdownToRemark) - .use(remarkToMarkdown, { commonmark: true, footnotes: true, pedantic: true }) + .use(remarkToMarkdown, { fences: true, commonmark: true, footnotes: true, pedantic: true }) .processSync(md); + console.log(processedMarkdown.contents); this.props.onChange(processedMarkdown.contents); this.view.updateState(newState); if (newState.selection !== this.state.selection) { diff --git a/src/components/Widgets/MarkdownControl/VisualEditor/parser.js b/src/components/Widgets/MarkdownControl/VisualEditor/parser.js index e06c4d2d..9c6a0882 100644 --- a/src/components/Widgets/MarkdownControl/VisualEditor/parser.js +++ b/src/components/Widgets/MarkdownControl/VisualEditor/parser.js @@ -12,7 +12,7 @@ const state = { activeMarks: Mark.none, textsArray: [] }; */ function parser(src) { const result = unified() - .use(remarkToMarkdown, { commonmark: true, footnotes: true, pedantic: true }) + .use(remarkToMarkdown, { fences: true, footnotes: true, pedantic: true }) .parse(src); return unified() diff --git a/src/components/Widgets/MarkdownPreview/index.js b/src/components/Widgets/MarkdownPreview/index.js index cfb09370..9a9594ed 100644 --- a/src/components/Widgets/MarkdownPreview/index.js +++ b/src/components/Widgets/MarkdownPreview/index.js @@ -9,7 +9,7 @@ import previewStyle from '../defaultPreviewStyle'; const MarkdownPreview = ({ value, getAsset }) => { const Markdown = unified() - .use(markdownToRemark, { commonmark: true, footnotes: true, pedantic: true }) + .use(markdownToRemark, { footnotes: true, pedantic: true }) .use(remarkToRehype, { allowDangerousHTML: true }) .use(cmsPluginToRehype, { getAsset }) .use(rehypeToReact, { createElement: React.createElement })