(markdown: string, opts?: ParseContext)
| 118 | } |
| 119 | |
| 120 | parse(markdown: string, opts?: ParseContext): JSONContent { |
| 121 | if (!markdown.trim()) { |
| 122 | return { |
| 123 | type: 'doc', |
| 124 | content: [{ type: 'paragraph', content: [] }], |
| 125 | }; |
| 126 | } |
| 127 | this.parseCtx.current = opts ?? {}; |
| 128 | try { |
| 129 | const doc = parseMd(markdown, this.parseProcessor); |
| 130 | return doc.toJSON() as JSONContent; |
| 131 | } finally { |
| 132 | this.parseCtx.current = {}; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | parseToMdast(markdown: string): MdastRoot { |
| 137 | if (!markdown.trim()) { |