MCPcopy
hub / github.com/refined-github/refined-github / parseBackticks

Function parseBackticks

source/github-helpers/parse-backticks.tsx:10–26  ·  view source on GitHub ↗
(description: string)

Source from the content-addressed store, hash-verified

8}
9
10export default function parseBackticks(description: string): DocumentFragment {
11 const fragment = new DocumentFragment();
12 for (const [index, text] of getParsedBackticksParts(description).entries()) {
13 if (index % 2 && text.length > 0) {
14 // `span.sr-only` keeps the backticks copy-pastable but invisible
15 fragment.append(
16 <span className="sr-only">`</span>,
17 <code className="rgh-parse-backticks">{text.trim()}</code>,
18 <span className="sr-only">`</span>,
19 );
20 } else if (text.length > 0) {
21 fragment.append(text);
22 }
23 }
24
25 return fragment;
26}

Callers

nothing calls this directly

Calls 2

getParsedBackticksPartsFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected