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

Function trimTrailingWhitespaceInMarkdown

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

resolveFunction · 0.85
readFileFunction · 0.85

Tested by

no test coverage detected