Skip to content

Commit 9614ff3

Browse files
committed
(feat) support parsing nested markdown using FromMarkdown
Signed-off-by: Dan Selman <danscode@selman.org>
1 parent 441cfca commit 9614ff3

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/markdown/fromMarkdown.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,6 @@ export default class FromMarkdown extends Markdown {
6767
return Value.fromJSON(this.root);
6868
}
6969

70-
/**
71-
* Converts markdown text to a Slate.js Value object using
72-
* a new instance of FromMarkdown.
73-
* @param {*} markdownText
74-
* @return {Object} the Slate.js Value object
75-
*/
76-
parseNestedMarkdown(markdownText) {
77-
const newParser = new FromMarkdown(this.pluginManager);
78-
return newParser.convert(markdownText);
79-
}
80-
8170
/**
8271
* Any nodes that are not processed by this class are dispatched to the
8372
* PluginManager.
@@ -91,7 +80,10 @@ export default class FromMarkdown extends Markdown {
9180

9281
if (plugin && typeof plugin.fromMarkdown === 'function') {
9382
// console.log(`found plugin for ${tagInfo ? tagInfo.tag : node}`);
94-
return plugin.fromMarkdown(this.stack, event, tagInfo, node, this.parseNestedMarkdown);
83+
return plugin.fromMarkdown(this.stack, event, tagInfo, node, ((markdownText) => {
84+
const newParser = new FromMarkdown(this.pluginManager);
85+
return newParser.convert(markdownText);
86+
}));
9587
}
9688

9789
return false;

0 commit comments

Comments
 (0)