mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-29 21:26:51 +02:00
docs: Update new shape registration doc
This commit is contained in:
@@ -101,7 +101,7 @@ To add a new shape:
|
|||||||
- **Example**:
|
- **Example**:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Node, RenderOptions } from '../../types.d.ts';
|
import { Node, RenderOptions } from '../../types.ts';
|
||||||
|
|
||||||
export const myNewShape = async (
|
export const myNewShape = async (
|
||||||
parent: SVGAElement,
|
parent: SVGAElement,
|
||||||
@@ -117,7 +117,7 @@ To add a new shape:
|
|||||||
|
|
||||||
### 2. Register the Shape
|
### 2. Register the Shape
|
||||||
|
|
||||||
- **Register the shape**: Add your shape to the `shapes` object in the main shapes module. This allows your shape to be recognized and used within the system.
|
- **Register the shape**: Add your shape to the `shapes` object in the [main shapes module](../rendering-util/rendering-elements/shapes.ts). This allows your shape to be recognized and used within the system.
|
||||||
|
|
||||||
- **Example**:
|
- **Example**:
|
||||||
|
|
||||||
@@ -126,9 +126,14 @@ To add a new shape:
|
|||||||
|
|
||||||
const shapes = {
|
const shapes = {
|
||||||
...,
|
...,
|
||||||
'my-new-shape': myNewShape,
|
{
|
||||||
// Shortened alias (if any).
|
semanticName: 'My Shape',
|
||||||
'm-nsh': myNewShape
|
name: 'Shape Name',
|
||||||
|
shortName: '<short-name>',
|
||||||
|
description: '<Description for the shape>',
|
||||||
|
aliases: ['<alias-one>', '<al-on>', '<alias-two>', '<al-two>'],
|
||||||
|
handler: myNewShape,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ To add a new shape:
|
|||||||
- **Example**:
|
- **Example**:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Node, RenderOptions } from '../../types.d.ts';
|
import { Node, RenderOptions } from '../../types.ts';
|
||||||
|
|
||||||
export const myNewShape = async (
|
export const myNewShape = async (
|
||||||
parent: SVGAElement,
|
parent: SVGAElement,
|
||||||
@@ -111,7 +111,7 @@ To add a new shape:
|
|||||||
|
|
||||||
### 2. Register the Shape
|
### 2. Register the Shape
|
||||||
|
|
||||||
- **Register the shape**: Add your shape to the `shapes` object in the main shapes module. This allows your shape to be recognized and used within the system.
|
- **Register the shape**: Add your shape to the `shapes` object in the [main shapes module](../rendering-util/rendering-elements/shapes.ts). This allows your shape to be recognized and used within the system.
|
||||||
|
|
||||||
- **Example**:
|
- **Example**:
|
||||||
|
|
||||||
@@ -120,9 +120,14 @@ To add a new shape:
|
|||||||
|
|
||||||
const shapes = {
|
const shapes = {
|
||||||
...,
|
...,
|
||||||
'my-new-shape': myNewShape,
|
{
|
||||||
// Shortened alias (if any).
|
semanticName: 'My Shape',
|
||||||
'm-nsh': myNewShape
|
name: 'Shape Name',
|
||||||
|
shortName: '<short-name>',
|
||||||
|
description: '<Description for the shape>',
|
||||||
|
aliases: ['<alias-one>', '<al-on>', '<alias-two>', '<al-two>'],
|
||||||
|
handler: myNewShape,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user