mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-08 18:16:44 +02:00
fix: Formatting issue
This commit is contained in:
33
src/docs.mts
33
src/docs.mts
@@ -54,6 +54,15 @@ const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DO
|
||||
const verifyOnly: boolean = process.argv.includes('--verify');
|
||||
const git: boolean = process.argv.includes('--git');
|
||||
|
||||
// TODO: Read from .prettierrc?
|
||||
const prettierConfig: prettier.Config = {
|
||||
useTabs: false,
|
||||
tabWidth: 2,
|
||||
endOfLine: 'auto',
|
||||
printWidth: 100,
|
||||
singleQuote: true,
|
||||
};
|
||||
|
||||
let filesWereTransformed = false;
|
||||
|
||||
/**
|
||||
@@ -151,19 +160,11 @@ const transformMarkdown = (file: string) => {
|
||||
|
||||
// Add the AUTOGENERATED_TEXT to the start of the file
|
||||
const transformed = `${AUTOGENERATED_TEXT}\n${remark.stringify(out)}`;
|
||||
|
||||
copyTransformedContents(
|
||||
file,
|
||||
!verifyOnly,
|
||||
prettier.format(transformed, {
|
||||
parser: 'markdown',
|
||||
useTabs: false,
|
||||
tabWidth: 2,
|
||||
endOfLine: 'auto',
|
||||
printWidth: 100,
|
||||
singleQuote: true,
|
||||
})
|
||||
);
|
||||
const formatted = prettier.format(transformed, {
|
||||
parser: 'markdown',
|
||||
...prettierConfig,
|
||||
});
|
||||
copyTransformedContents(file, !verifyOnly, formatted);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -194,7 +195,11 @@ const transformHtml = (filename: string) => {
|
||||
};
|
||||
|
||||
const transformedHTML = insertAutoGeneratedComment(filename);
|
||||
copyTransformedContents(filename, !verifyOnly, transformedHTML);
|
||||
const formattedHTML = prettier.format(transformedHTML, {
|
||||
parser: 'html',
|
||||
...prettierConfig,
|
||||
});
|
||||
copyTransformedContents(filename, !verifyOnly, formattedHTML);
|
||||
};
|
||||
|
||||
/** Main method (entry point) */
|
||||
|
Reference in New Issue
Block a user