MCPcopy Create free account
hub / github.com/chieapp/chie / appendText

Method appendText

src/util/streamed-markdown.ts:84–99  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

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)

Callers 2

#onMessageDeltaMethod · 0.80
messageToJSONFunction · 0.80

Calls 3

veryLikelyMarkdownFunction · 0.85
escapeTextFunction · 0.85
computeHtmlDeltaFunction · 0.85

Tested by

no test coverage detected