Skip to content

Commit b55fb54

Browse files
committed
Fix lint error
1 parent 4904ef3 commit b55fb54

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

build/html.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import * as fs from 'node:fs';
22
import * as path from 'node:path';
33
import * as url from 'node:url';
4+
import prettier from 'prettier';
45
import stripIndent from 'common-tags/lib/stripIndent/index.js';
56

67
const __filename = url.fileURLToPath(import.meta.url);
78
const __dirname = path.dirname(__filename);
9+
const prettierConfig = prettier.resolveConfig.sync(__dirname);
810

911
// Preview
1012
// =============================================================================
@@ -27,9 +29,14 @@ function generatePreview() {
2729
.replace(/(<\/title>)/, ' (Preview)$1')
2830
// Replace CDN URLs with local paths
2931
.replace(/\/\/cdn.jsdelivr.net\/npm\/docsify@4\//g, '/');
32+
const formattedHTML = prettier.format(outHTML, {
33+
...prettierConfig,
34+
filepath: outFile,
35+
});
3036

3137
console.log(`\nBuilding ${outFile} in ${outPath}`);
32-
fs.writeFileSync(path.resolve(outPath, outFile), outHTML);
38+
39+
fs.writeFileSync(path.resolve(outPath, outFile), formattedHTML);
3340
}
3441

3542
generatePreview();

0 commit comments

Comments
 (0)