|
@@ -125,10 +125,15 @@ export class MarkdownRuleEngine {
|
|
|
const tree: Tree = markdownParser.parse(docText, fragments)
|
|
const tree: Tree = markdownParser.parse(docText, fragments)
|
|
|
const parseTime = performance.now() - startTime
|
|
const parseTime = performance.now() - startTime
|
|
|
|
|
|
|
|
|
|
+ const visitedNodeTypes: string[] = []
|
|
|
|
|
+
|
|
|
tree.iterate({
|
|
tree.iterate({
|
|
|
enter: (ref) => {
|
|
enter: (ref) => {
|
|
|
const node = ref.node
|
|
const node = ref.node
|
|
|
const nodeType = node.type.name
|
|
const nodeType = node.type.name
|
|
|
|
|
+ visitedNodeTypes.push(nodeType)
|
|
|
|
|
+
|
|
|
|
|
+ log.info("ENTER", { type: nodeType, from: node.from, to: node.to, text: JSON.stringify(node.to - node.from <= 50 ? docText.slice(node.from, node.to) : "...") })
|
|
|
|
|
|
|
|
const blockCandidates = this.blockRuleIndex.get(nodeType)
|
|
const blockCandidates = this.blockRuleIndex.get(nodeType)
|
|
|
if (blockCandidates) {
|
|
if (blockCandidates) {
|
|
@@ -145,6 +150,8 @@ export class MarkdownRuleEngine {
|
|
|
const node = ref.node
|
|
const node = ref.node
|
|
|
const nodeType = node.type.name
|
|
const nodeType = node.type.name
|
|
|
|
|
|
|
|
|
|
+ log.info("LEAVE", { type: nodeType })
|
|
|
|
|
+
|
|
|
if (this.blockRuleIndex.has(nodeType)) return
|
|
if (this.blockRuleIndex.has(nodeType)) return
|
|
|
|
|
|
|
|
const inlineCandidates = this.inlineRuleIndex.get(nodeType)
|
|
const inlineCandidates = this.inlineRuleIndex.get(nodeType)
|
|
@@ -174,6 +181,9 @@ export class MarkdownRuleEngine {
|
|
|
inlineTokens: content.length,
|
|
inlineTokens: content.length,
|
|
|
properties: properties.length,
|
|
properties: properties.length,
|
|
|
incremental: !!oldTree,
|
|
incremental: !!oldTree,
|
|
|
|
|
+ tree: visitedNodeTypes.join("→"),
|
|
|
|
|
+ blockTypes: blocks.map((b: any) => b.type).join(","),
|
|
|
|
|
+ inlineTypes: content.map((c: any) => c.type).join(","),
|
|
|
})
|
|
})
|
|
|
return { content, properties, blocks, tree }
|
|
return { content, properties, blocks, tree }
|
|
|
}
|
|
}
|