updated check to avoid _ in shape syntax. updated readme path

This commit is contained in:
saurabhg772244
2024-09-24 13:29:12 +05:30
parent b3dfc60fff
commit 1c8c95367d
3 changed files with 8 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
> >
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. > ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
> >
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/adding-new-shape/Readme.md](../../packages/mermaid/src/docs/adding-new-shape/Readme.md). > ## Please edit the corresponding file in [/packages/mermaid/src/docs/adding-new-shape.md](../packages/mermaid/src/docs/adding-new-shape.md).
# Custom SVG Shapes Library # Custom SVG Shapes Library
@@ -126,7 +126,9 @@ To add a new shape:
const shapes = { const shapes = {
..., ...,
myNewShape, 'my-new-shape': myNewShape,
// Shortened alias (if any).
'm-nsh': myNewShape
}; };
``` ```

View File

@@ -133,7 +133,7 @@ export const addVertex = function (
} }
// console.log('yamlData', yamlData); // console.log('yamlData', yamlData);
const doc = yaml.load(yamlData, { schema: yaml.JSON_SCHEMA }) as NodeMetaData; const doc = yaml.load(yamlData, { schema: yaml.JSON_SCHEMA }) as NodeMetaData;
if (doc.shape && doc.shape !== doc.shape.toLowerCase()) { if (doc.shape && (doc.shape !== doc.shape.toLowerCase() || doc.shape.includes('_'))) {
throw new Error(`No such shape: ${doc.shape}. Shape names should be lowercase.`); throw new Error(`No such shape: ${doc.shape}. Shape names should be lowercase.`);
} }

View File

@@ -120,7 +120,9 @@ To add a new shape:
const shapes = { const shapes = {
..., ...,
myNewShape, 'my-new-shape': myNewShape,
// Shortened alias (if any).
'm-nsh': myNewShape
}; };
``` ```