mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
fix: trimStart to text
This commit is contained in:
parent
d16894daf4
commit
1945a62990
@ -14,13 +14,13 @@ graph TD
|
|||||||
%% This is a comment
|
%% This is a comment
|
||||||
`;
|
`;
|
||||||
expect(cleanupComments(text)).toMatchInlineSnapshot(`
|
expect(cleanupComments(text)).toMatchInlineSnapshot(`
|
||||||
"
|
"
|
||||||
|
|
||||||
graph TD
|
graph TD
|
||||||
A-->B
|
A-->B
|
||||||
|
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should keep init statements when removing comments', () => {
|
it('should keep init statements when removing comments', () => {
|
||||||
@ -61,12 +61,12 @@ graph TD
|
|||||||
C-->D
|
C-->D
|
||||||
`;
|
`;
|
||||||
expect(cleanupComments(text)).toMatchInlineSnapshot(`
|
expect(cleanupComments(text)).toMatchInlineSnapshot(`
|
||||||
"
|
"
|
||||||
graph TD
|
graph TD
|
||||||
A-->B
|
A-->B
|
||||||
|
|
||||||
C-->D
|
C-->D
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
* @returns cleaned text
|
* @returns cleaned text
|
||||||
*/
|
*/
|
||||||
export const cleanupComments = (text: string): string => {
|
export const cleanupComments = (text: string): string => {
|
||||||
return text.replace(/^\s*%%(?!{)[^\n]+/gm, '');
|
return text.trimStart().replace(/^\s*%%(?!{)[^\n]+/gm, '');
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user