MCPcopy Create free account
hub / github.com/TanStack/query / trimTrailingWhitespaceInMarkdown

Function trimTrailingWhitespaceInMarkdown

scripts/generate-docs.ts:76–100  ·  view source on GitHub ↗
(outputDir: string)

Source from the content-addressed store, hash-verified

74}
75
76async function trimTrailingWhitespaceInMarkdown(outputDir: string) {
77 const entries = await readdir(outputDir, { withFileTypes: true })
78
79 await Promise.all(
80 entries.map(async (entry) => {
81 const path = resolve(outputDir, entry.name)
82
83 if (entry.isDirectory()) {
84 await trimTrailingWhitespaceInMarkdown(path)
85 return
86 }
87
88 if (!entry.isFile() || !path.endsWith('.md')) {
89 return
90 }
91
92 const markdown = await readFile(path, 'utf8')
93 const trimmed = markdown.replace(/[ \t]+$/gm, '')
94
95 if (trimmed !== markdown) {
96 await writeFile(path, trimmed)
97 }
98 }),
99 )
100}
101
102async function generatePackageReferenceDocs(pkg: PackageReferenceDocsConfig) {
103 const outputDir = pkg.outputDir

Callers 1

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected