MCPcopy
hub / github.com/prettier/prettier / textToDoc

Function textToDoc

src/main/multiparser.js:108–132  ·  view source on GitHub ↗
(
  text,
  partialNextOptions,
  parentOptions,
  printAstToDoc,
)

Source from the content-addressed store, hash-verified

106}
107
108async function textToDoc(
109 text,
110 partialNextOptions,
111 parentOptions,
112 printAstToDoc,
113) {
114 const options = await normalizeFormatOptions(
115 {
116 ...parentOptions,
117 ...partialNextOptions,
118 parentParser: parentOptions.parser,
119 originalText: text,
120 // Improve this if we calculate the relative index
121 cursorOffset: undefined,
122 rangeStart: undefined,
123 rangeEnd: undefined,
124 },
125 { passThrough: true },
126 );
127
128 const { ast } = await parse(text, options);
129 const doc = await printAstToDoc(ast, options);
130
131 return stripTrailingHardline(doc);
132}
133
134export { printEmbeddedLanguages };

Callers 13

embedFunction · 0.85
printStyleFunction · 0.85
formatAttributeValueFunction · 0.85
embedFunction · 0.85
textToDocForEmbedFunction · 0.85
printEmbedFrontMatterFunction · 0.85
embedFunction · 0.85
embedFunction · 0.85
printEmbedMarkdownFunction · 0.85
printEmbedGraphQLFunction · 0.85
printEmbedCssFunction · 0.85
printEmbedHtmlLikeFunction · 0.85

Calls 4

stripTrailingHardlineFunction · 0.90
normalizeFormatOptionsFunction · 0.85
printAstToDocFunction · 0.85
parseFunction · 0.70

Tested by 1

makePluginFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…