(text: string)
| 82 | } |
| 83 | |
| 84 | appendText(text: string): MarkdownHtmlDelta { |
| 85 | this.isMarkdown = this.isMarkdown || veryLikelyMarkdown(text); |
| 86 | this.text += text; |
| 87 | const options: marked.MarkedOptions = { |
| 88 | walkTokens: this.links ? this.#walkTokens.bind(this) : undefined, |
| 89 | renderer: this.renderer, |
| 90 | breaks: true, |
| 91 | silent: true, |
| 92 | }; |
| 93 | const html = this.isMarkdown ? marked.parse(this.text, options) : escapeText(this.text); |
| 94 | const result = computeHtmlDelta(this.html, html); |
| 95 | if (!result) // essentially no change |
| 96 | return {type: 'append', html: ''}; |
| 97 | this.html = html; |
| 98 | return result; |
| 99 | } |
| 100 | |
| 101 | #walkTokens(token) { |
| 102 | if (token.type == 'bingReference' && token.num - 1 < this.links.length) |
no test coverage detected