MCPcopy Create free account
hub / github.com/chainjet/platform / stripMarkdown

Function stripMarkdown

libs/common/src/utils/string.utils.ts:25–38  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

23 * Removes markdown and html from a string
24 */
25export function stripMarkdown(str: string): Promise<string> {
26 // A @ is added at the beginning and then removed before returning, as a work around for an open issue:
27 // https://github.com/remarkjs/strip-markdown/issues/19
28 return new Promise((resolve, reject) => {
29 remark()
30 .use(strip)
31 .process('@' + str, (err, file) => {
32 if (err) {
33 return reject(err)
34 }
35 resolve(file.toString().trim().substr(1))
36 })
37 })
38}
39
40export function stripMarkdownSync(str: string): string {
41 // A @ is added at the beginning and then removed before returning, as a work around for an open issue:

Callers 4

stripSchemaMarkdownFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected