switch remark options to use gfm, fences
This commit is contained in:
parent
b293b235bb
commit
e7ac3a7671
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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()
|
||||
|
@ -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 })
|
||||
|
Loading…
x
Reference in New Issue
Block a user