mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
optional auto wrapping for markdownToLines
This commit is contained in:
parent
a75d14f5d0
commit
0af77a3c2c
@ -9,10 +9,16 @@ import { getConfig } from '../config.js';
|
|||||||
* @returns processed markdown
|
* @returns processed markdown
|
||||||
*/
|
*/
|
||||||
function preprocessMarkdown(markdown: string): string {
|
function preprocessMarkdown(markdown: string): string {
|
||||||
|
const markdownAutoWrap = getConfig().markdownAutoWrap;
|
||||||
// Replace multiple newlines with a single newline
|
// Replace multiple newlines with a single newline
|
||||||
const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, '\n');
|
const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, '\n');
|
||||||
// Remove extra spaces at the beginning of each line
|
// Remove extra spaces at the beginning of each line
|
||||||
const withoutExtraSpaces = dedent(withoutMultipleNewlines);
|
const withoutExtraSpaces = dedent(withoutMultipleNewlines);
|
||||||
|
/*
|
||||||
|
if (markdownAutoWrap === false) {
|
||||||
|
return withoutExtraSpaces.replace(/ /g, ' ');
|
||||||
|
}
|
||||||
|
*/
|
||||||
return withoutExtraSpaces;
|
return withoutExtraSpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user