MCPcopy
hub / github.com/freshframework/fresh / text

Method text

www/utils/markdown.ts:88–108  ·  view source on GitHub ↗
(
    token: Marked.Tokens.Text | Marked.Tokens.Escape | Marked.Tokens.Tag,
  )

Source from the content-addressed store, hash-verified

86 slugger = new GitHubSlugger();
87
88 override text(
89 token: Marked.Tokens.Text | Marked.Tokens.Escape | Marked.Tokens.Tag,
90 ): string {
91 if (
92 token.type === "text" && "tokens" in token && token.tokens !== undefined
93 ) {
94 return this.parser.parseInline(token.tokens);
95 }
96
97 // Smartypants typography enhancement
98 return token.text
99 .replaceAll("...", "…")
100 .replaceAll("--", "—")
101 .replaceAll("---", "–")
102 .replaceAll(/(\w)'(\w)/g, "$1’$2")
103 .replaceAll(/s'/g, "s’")
104 .replaceAll("'", "’")
105 .replaceAll(/["](.*?)["]/g, "“$1&#8221")
106 .replaceAll(/"(.*?)"/g, "“$1&#8221")
107 .replaceAll(/['](.*?)[']/g, "‘$1’");
108 }
109
110 override heading({ tokens, depth }: Marked.Tokens.Heading): string {
111 this.#assert(tokens.length > 0, "Markdown heading tokens unexpected value");

Callers 1

crawlPageFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected