MCPcopy
hub / github.com/github/docs / fastTextOnly

Function fastTextOnly

lib/render-content/renderContent.js:68–75  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

66// we get here is a single line that starts with `<p>` and ends with `</p>`
67// and contains no longer HTML tags.
68function fastTextOnly(html) {
69 if (!html) return ''
70 if (html.startsWith('<p>') && html.endsWith('</p>')) {
71 const middle = html.slice(3, -4)
72 if (!middle.includes('<')) return decode(middle.trim())
73 }
74 return cheerio.load(html, { xmlMode: true }).text().trim()
75}
76
77renderContent.liquid = liquid
78

Callers 1

renderContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected