MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / createTextNodes

Function createTextNodes

scripts/docs/src/generate-cli-docs.ts:91–112  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

89}
90
91function createTextNodes(text: string): PhrasingContent[] {
92 if (!text) {
93 return [];
94 }
95
96 const nodes: PhrasingContent[] = [];
97 const parts = text.split(/(`[^`]*`)/g);
98
99 parts.forEach((part) => {
100 if (!part) {
101 return;
102 }
103
104 if (part.startsWith("`") && part.endsWith("`")) {
105 nodes.push(createInlineCode(part.slice(1, -1)));
106 } else {
107 nodes.push(...createBracketAwareTextNodes(part));
108 }
109 });
110
111 return nodes;
112}
113
114function createBracketAwareTextNodes(text: string): PhrasingContent[] {
115 const nodes: PhrasingContent[] = [];

Callers 1

createParagraphFunction · 0.85

Calls 3

createInlineCodeFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…