switch remark options to use gfm, fences

This commit is contained in:
Shawn Erquhart 2017-06-13 15:30:11 -04:00
parent b293b235bb
commit e7ac3a7671
4 changed files with 6 additions and 4 deletions

View File

@ -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);
}

View File

@ -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) {

View File

@ -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()

View File

@ -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 })