diff --git a/dev-docs/docs/@excalidraw/excalidraw/api/props/render-props.mdx b/dev-docs/docs/@excalidraw/excalidraw/api/props/render-props.mdx index 2cec0dae..5256704c 100644 --- a/dev-docs/docs/@excalidraw/excalidraw/api/props/render-props.mdx +++ b/dev-docs/docs/@excalidraw/excalidraw/api/props/render-props.mdx @@ -80,7 +80,7 @@ The `` component takes these props (all are optional except `children`) | --- | --- | --- | | `children` | `React.ReactNode` | Content you want to render inside the `sidebar`. | | `onClose` | `function` | Invoked when the component is closed (by user, or the editor). No need to act on this event, as the editor manages the sidebar open state on its own. | -| `onDock` | `function` | Invoked when the user toggles the `dock` button. The callback recieves a `boolean` parameter `isDocked` which indicates whether the sidebar is `docked` | +| `onDock` | `function` | Invoked when the user toggles the `dock` button. The callback receives a `boolean` parameter `isDocked` which indicates whether the sidebar is `docked` | | `docked` | `boolean` | Indicates whether the sidebar is`docked`. By default, the sidebar is `undocked`. If passed, the docking becomes controlled, and you are responsible for updating the `docked` state by listening on `onDock` callback. To decide the breakpoint for docking you can use [UIOptions.dockedSidebarBreakpoint](/docs/@excalidraw/excalidraw/api/props/ui-options#dockedsidebarbreakpoint) for more info on docking. | | `dockable` | `boolean` | Indicates whether to show the `dock` button so that user can `dock` the sidebar. If `false`, you can still dock programmatically by passing `docked` as `true`. | diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/api.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/api.mdx new file mode 100644 index 00000000..a88bda5e --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/api.mdx @@ -0,0 +1,155 @@ +# API + +At the moment the mermaid-to-excalidraw works in two steps. First, you call `parseMermaidToExcalidraw(mermaidSyntax)` on the mermaid diagram definition string, which resolves with elements in a skeleton format — a simplified excalidraw JSON format (docs coming soon). You then pass them to `convertToExcalidrawElements(elements)` to get the fully qualified excalidraw elements you can render in the editor. + +The need for these two steps is due to the [@excalidraw/excalidraw](/docs/@excalidraw/excalidraw/installation) being a **UMD** build so we currently cannot import the `convertToExcalidrawElements()` util alone, until we support a tree-shakeable **ESM** build. + +## parseMermaidToExcalidraw + +This API receives the mermaid syntax as the input, and resolves to skeleton Excalidraw elements. You will need to call `convertToExcalidraw` API to convert them to fully qualified elements that you can render in Excalidraw. + +** Example ** + +```ts +import { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw"; +import { convertToExcalidrawElements} from "@excalidraw/excalidraw" +try { + const { elements, files } = await parseMermaid(mermaidSyntax: string, { + fontSize: number, + }); + const excalidrawElements = convertToExcalidrawElements(elements); + // Render elements and files on Excalidraw +} catch (e) { + // Parse error, displaying error message to users +} +``` + +## Supported Diagram Types + +Currently only [flowcharts](https://mermaid.js.org/syntax/flowchart.html) are supported. Oother diagram types will be rendered as an image in Excalidraw. + +### Flowchart + +#### Excalidraw Regular Shapes + +**Rectangles**, **Circle**, **Diamond**, and **Arrows** are fully supported in Excalidraw + +``` +flowchart TD + A[Christmas] -->|Get money| B(Go shopping) + B --> C{Let me think} + C -->|One| D[Laptop] + C -->|Two| E[iPhone] + C -->|Three| F[Car] + ``` + + + + +``` +flowchart LR + id1((Hello from Circle)) +``` + + + + +#### Subgraphs + +Subgraphs are grouped diagrams hence they are also supported in Excalidraw + +``` +flowchart TB + c1-->a2 + subgraph one + a1-->a2 + end + subgraph two + b1-->b2 + end + subgraph three + c1-->c2 + end +``` + + + +#### Unsupported shapes fallback to Rectangle + +**Subroutine**, **Cylindrical**, **Asymmetric**, **Hexagon**, **Parallelogram**, **Trapezoid** are not supported in Excalidraw hence they fallback to the closest shape **Rectangle** + +``` +flowchart LR + id1[[Subroutine fallback to Rectangle]] + id2[(Cylindrical fallback to Rectangle)] + id3>Asymmetric fallback to Rectangle] + id4{{Hexagon fallback to Rectangle}} + id5[/Parallelogram fallback to Rectangle /] + id6[/Trapezoid fallback to Rectangle\] +``` +The above shapes are not supported in Excalidraw hence they fallback to Rectangle + + + +#### Markdown fallback to Regular text + +Since we don't support wysiwyg text editor yet, hence [Markdown Strings](https://mermaid.js.org/syntax/flowchart.html#markdown-strings) will fallback to regular text. + +``` +flowchart LR + A("`Hello **World**`") --> B("`Whats **up** ?`") +``` + + +#### Basic FontAwesome fallback to text + +The [FontAwesome](https://mermaid.js.org/syntax/flowchart.html#basic-support-for-fontawesome) icons aren't support so they won't be rendered in Excalidraw + +``` +flowchart TD + B["fab:fa-twitter for peace"] + B-->C[fa:fa-ban forbidden] + B-->E(A fa:fa-camera-retro perhaps?) +``` + + + + +#### Cross Arrow head fallback to Bar Arrow head + +``` +flowchart LR + Start x--x Stop +``` + + + +## Unsupported Diagram Types + +Currently only [flowcharts](https://mermaid.js.org/syntax/flowchart.html) are supported. All other diagram types will be rendered as an image in Excalidraw. + +``` +erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses +``` + + + +``` +gitGraph + commit + commit + branch develop + checkout develop + commit + commit + checkout main + merge develop + commit + commit + +``` + + diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/codebase.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/codebase.mdx new file mode 100644 index 00000000..02a48ee5 --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/codebase.mdx @@ -0,0 +1,7 @@ +# Codebase + +The Codebase is divided into 2 Sections + +* [How Parser Works under the hood](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser) - If you are interested in understanding and deep diving into inner workings of the Parser, then make sure to checkout this section. + +* [Adding a new diagram type](/docs/@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type) - If you want to help us make the mermaid to Excalidraw Parser more powerful, you will find all information in this section to do so. diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type.mdx new file mode 100644 index 00000000..c59dfaba --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type.mdx @@ -0,0 +1,54 @@ +# Adding a new Diagram Type + +To add a new diagram type to the parser you can follow the below steps :point_down: + +All the code for the parser resides in [`src`](https://github.com/excalidraw/mermaid-to-excalidraw/tree/master/src) folder and for playground resides in [`playground`](https://github.com/excalidraw/mermaid-to-excalidraw/tree/master/playground) folder. + +lets run the playground server in local :point_down: + +```bash +yarn start +``` + +This will start the playground server in port `1234` and open it in browser so you start playing with the playground. + +## Update Supported Diagram Types + +First step is to add the new diagram type in [`SUPPORTED_DIAGRAM_TYPES`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/constants.ts#L2). + +Once this is done the new diagram type won't be rendered as an image but start throwing error since we don't support parsing the data yet. + +## Writing the Diagram Parser + +Once the diagram type is added in previous step. Next step is to write the parser to parse the mermaid diagram. + +For this create a file named `{{diagramType}}.ts` in [`src/parser`](https://github.com/excalidraw/mermaid-to-excalidraw/tree/master/src/parser) and write a function `parseMermaid{{diagramType}}Diagram` similar to how we [`parseMermaidFlowChartDiagram`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parser/flowchart.ts#L256) for parsing flowchart diagram. + +The main aim of the parser is :point_down: + +1. Determine how elements are connected in the diagram and thus finding arrow and text bindings. + +For this you might have to dig in to the parser `diagram.parser.yy` and which attributes to parse for the new diagram. + +2. Determine the position and dimensions of each element, for this would be using the `svg` + +Once the parser is ready, lets start using it. + +Add the diagram type in switch case in [`parseMermaid`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L97) and call the parser for the same. + +## Writing the Excalidraw Skeleton Convertor + +With the completion of previous step, we have all the data, now we need to transform it so to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/src/data/transform.ts#L133) format. + +Similar to [`FlowChartToExcalidrawSkeletonConverter`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/converter/types/flowchart.ts#L24), you have to write the `{{diagramType}}ToExcalidrawSkeletonConverter` which parses the data received in previous step and returns the [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/src/data/transform.ts#L133). + +Thats it, you have added the new diagram type 🥳, now lets test it out! + +## Updating the Playground + +1. Create a file named `{{diagramType}}.ts` in [`playround/testcases/`](https://github.com/excalidraw/mermaid-to-excalidraw/tree/master/playground/testcases). For reference you can check [`flowchart.ts`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/playground/testcases/flowchart.ts). + +2. Incase the new diagram type added is present in [`unsupported.ts`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/playground/testcases/unsupported.ts) then remove it from there. + +3. Verify if the test cases are running fine in playground. + diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/flowchart.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/flowchart.mdx new file mode 100644 index 00000000..b8d122df --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/flowchart.mdx @@ -0,0 +1,177 @@ +# Flowchart Parser + +As mentioned in the previous section, we use [getDiagramFromText](https://github.com/mermaid-js/mermaid/blob/00d06c7282a701849793680c1e97da1cfdfcce62/packages/mermaid/src/Diagram.ts#L80) to parse the full defination and get the [Diagram](https://github.com/mermaid-js/mermaid/blob/00d06c7282a701849793680c1e97da1cfdfcce62/packages/mermaid/src/Diagram.ts#L15) json from it. + +In this section we will be diving into how the [flowchart parser](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parser/flowchart.ts#L256) works behind the scenes. + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/2a097bbb-64bf-49d6-bf7f-21172bdb538d) + +We use `diagram.parser.yy` attribute to parse the data. If you want to know more about how the `diagram.parse.yy` attribute looks like, you can check it [here](https://github.com/mermaid-js/mermaid/blob/00d06c7282a701849793680c1e97da1cfdfcce62/packages/mermaid/src/diagrams/flowchart/flowDb.js#L768), however for scope of flowchart we are using **3** APIs from this parser to compute `vertices`, `edges` and `clusters` as we need these data to transform to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/src/data/transform.ts#L133C13-L133C38). + + +For computing `vertices` and `edge`s lets consider the below svg generated by mermaid + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/d7013305-0b90-4fa0-a66e-b4f4604ad0b2) + + +## Computing the vertices + +We use `getVertices` API from `diagram.parse.yy` to get the vertices for a given flowchart. + +Considering the same example this is the response from the API + +```js +{ + "start": { + "id": "start", + "labelType": "text", + "domId": "flowchart-start-1414", + "styles": [], + "classes": [], + "text": "start", + "props": {} + }, + "stop": { + "id": "stop", + "labelType": "text", + "domId": "flowchart-stop-1415", + "styles": [], + "classes": [], + "text": "stop", + "props": {} + } +} +``` +The dimensions and position is missing in this response and we need that to transform to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/src/data/transform.ts#L133C13-L133C38), for this we have our own parser [`parseVertex`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L178) which takes the above response and uses the `svg` together to compute position, dimensions and cleans up the response. + + The final output from `parseVertex` looks like :point_down: + +```js +{ + "start": { + "id": "start", + "labelType": "text", + "text": "start", + "x": 0, + "y": 0, + "width": 67.796875, + "height": 44, + "containerStyle": {}, + "labelStyle": {} + }, + "stop": { + "id": "stop", + "labelType": "text", + "text": "stop", + "x": 117.796875, + "y": 0, + "width": 62.3828125, + "height": 44, + "containerStyle": {}, + "labelStyle": {} + } +} +``` + + +## Computing the edges + +The lines and arrows are considered as `edges` in mermaid as shown in the above diagram. +We use `getEdges` API from `diagram.parse.yy` to get the edges for a given flowchart. +Considering the same example this is the response from the API + +```js +[ + { + "start": "start", + "end": "stop", + "type": "arrow_point", + "text": "", + "labelType": "text", + "stroke": "normal", + "length": 1 + } +] +``` + +Similarly here the dimensions and position is missing and we compute that from the svg. The [`parseEdge`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L245) takes the above response along with `svg` and computes the position, dimensions and cleans up the response. + + The final output from `parseEdge` looks like :point_down: + +```js +[ + { + "start": "start", + "end": "stop", + "type": "arrow_point", + "text": "", + "labelType": "text", + "stroke": "normal", + "startX": 67.797, + "startY": 22, + "endX": 117.797, + "endY": 22, + "reflectionPoints": [ + { + "x": 67.797, + "y": 22 + }, + { + "x": 117.797, + "y": 22 + } + ] + } +] +``` +## Computing the Subgraphs + +`Subgraphs` is collection of elements grouped together. The Subgraphs map to `grouping` elements in Excalidraw. + +Lets consider the below example :point_down: + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/5243ce4c-beaa-43d2-812a-0577b0a574d7) + +We use `getSubgraphs` API to get the subgraph data for a given flowchart. +Considering the same example this is the response from the API + +```js +[ + { + "id": "one", + "nodes": [ + "flowchart-a2-1399", + "flowchart-a1-1400" + ], + "title": "one", + "classes": [], + "labelType": "text" + } +] +``` + +For position and dimensions we use the svg to compute. The [`parseSubgraph`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L139) takes the above response along with `svg` and computes the position, dimensions and cleans up the response. + + +```js +[ + { + "id": "one", + "nodes": [ + "flowchart-a2-1399", + "flowchart-a1-1400" + ], + "title": "one", + "labelType": "text", + "nodeIds": [ + "a2", + "a1" + ], + "x": 75.4921875, + "y": 0, + "width": 121.25, + "height": 188, + "text": "one" + } +] +``` \ No newline at end of file diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/parser.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/parser.mdx new file mode 100644 index 00000000..4f4af4de --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/parser.mdx @@ -0,0 +1,65 @@ +# How the Parser works under the hood ? + +[This](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/index.ts) is the entry point of the library. + + +`parseMermaidToExcalidraw` function is the only function exposed which receives mermaid syntax as the input, parses the mermaid syntax and resolves to Excalidraw Skeleton. + +Lets look at the high level overview at how the parse works :point_down: + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/8e060de7-b867-44ad-864b-0c1b24466b67) + +Lets dive deeper into individual section now to understand better. + +## Parsing Mermaid diagram + +One of the dependencies of the library is [`mermaid`](https://www.npmjs.com/package/mermaid) library. +We need the mermaid diagram in some extractable format so we can parse it to Excalidraw Elements. + +Parsing is broken into two steps +1. [`Rendering Mermaid to Svg`](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser#rendering-mermaid-to-svg) - This helps in determining the position and dimensions of each element in the diagram + +2. [`Parsing the mermaid syntax`](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser#parsing-the-mermaid-syntax) - We also need to know how elements are connected which isn't possible with svg alone hence we also parse the mermaid syntax which helps in determining the connections and bindings between elements in the diagram. + +### Rendering Mermaid to Svg + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/2c24cf7b-f096-4c12-88db-55520de27558) + +The [`mermaid`](https://www.npmjs.com/package/mermaid) library provides the API `mermaid.render` API which gives the output of the diagram in `svg`. + + +If the diagram isn't supported, this svg is converted to `dataURL` and can be rendered as an image in Excalidraw. + + +### Parsing the mermaid syntax + +For this we first need to process the options along with mermaid defination for diagram provided by the user. + +[`processMermaidTextWithOptions`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L13) takes the mermaid defination and options and returns the full defination including the mermaid [directives ](https://mermaid.js.org/config/directives.html). + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/3a4825d8-9704-468c-a02f-7e507f4d5b7a) + +Next we use mermaid api [getDiagramFromText](https://github.com/mermaid-js/mermaid/blob/00d06c7282a701849793680c1e97da1cfdfcce62/packages/mermaid/src/Diagram.ts#L80) to parse the full defination and get the [Diagram](https://github.com/mermaid-js/mermaid/blob/00d06c7282a701849793680c1e97da1cfdfcce62/packages/mermaid/src/Diagram.ts#L15) json from it. + +```js +const diagram = await mermaid.mermaidAPI.getDiagramFromText(fullDefinition); +``` + +Next we write our own parser to parse this diagram. + +### Parsing the Diagram + +For each diagram type, we need a parser as the result of every diagram would differ and dependinng on the data we have to write the parser. Since currently we support flowchart, so here is the [`parseMermaidFlowChartDiagram`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parser/flowchart.ts#L256) to parse the flowchart diagram. + +If you want to understand how flowchart parser works, you can navigate to [Flowchart Parser](http://localhost:3003/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser/flowchart). + +## Converting to ExcalidrawElementSkeleton + +Now we have all the data, we just need to transform it to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/src/data/transform.ts#L133C13-L133C38) API so it can be rendered in Excalidraw. + +For this we have `converters` which takes the parsed mermaid data and gives back the Excalidraw Skeleton. +For Unsupported types, we have already mentioned above that we convert it to `dataURL` and return the ExcalidrawImageSkeleton. + +For supported types, currently only flowchart, we have [flowchartConverter](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/converter/types/flowchart.ts#L24) which parses the data and converts to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/src/data/transform.ts#L133C13-L133C38). + +![image](https://github.com/excalidraw/excalidraw/assets/11256141/00226e9d-043d-4a08-989a-3ad9d2a574f1) \ No newline at end of file diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/development.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/development.mdx new file mode 100644 index 00000000..818465a3 --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/development.mdx @@ -0,0 +1,60 @@ +# Development + +This page relates to developing the `@excalidraw/mermaid-to-excalidraw` package itself. + +## Setting up in Local + +To set up the library in local, follow the below steps 👇🏼 + +### Clone the Repository + +Go to [@excalidraw/mermaid-to-excalidraw](https://github.com/excalidraw/mermaid-to-excalidraw) and clone the repository to your local. + + +```bash +git clone git@github.com:excalidraw/mermaid-to-excalidraw.git +``` + +### Install the dependencies + +Using `npm` + +```bash +npm install @excalidraw/mermaid-to-excalidraw +``` + +Using `yarn` + +```bash +yarn add @excalidraw/mermaid-to-excalidraw +``` + +### Run the playground server + +```bash +yarn start +``` + +This will start the playground server in port `1234` and you start playing with the playground. + +## Creating a test release + +We will soon simplify creating release via commenting on GitHub PR similar till then you can create a release by following the below steps + +1. Create the build + +```bash +yarn build +``` + +This will create the dist folder which we need to publish next. + +2. Publish the library + +Update the package name and version in [package.json](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/package.json) and run the below command to publish it + +```bash +yarn publish +``` + +And thats all your test release is successfully created 🎉 diff --git a/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/installation.mdx b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/installation.mdx new file mode 100644 index 00000000..1860fdf6 --- /dev/null +++ b/dev-docs/docs/@excalidraw/mermaid-to-excalidraw/installation.mdx @@ -0,0 +1,42 @@ +# Installation + +`@excalidraw/mermaid-to-excalidraw` is published to npm. This library is used in [excalidraw](https://excalidraw.com) to transform mermaid syntax to Excalidraw diagrams. + +Using `npm` + +```bash +npm install @excalidraw/mermaid-to-excalidraw +``` + +Using `yarn` + +```bash +yarn add @excalidraw/mermaid-to-excalidraw +``` + +## Usage + +Once the library is installed, its ready to use. + +```js +import { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw"; +import { convertToExcalidrawElements} from "@excalidraw/excalidraw" + +try { + const { elements, files } = await parseMermaid(diagramDefinition, { + fontSize: DEFAULT_FONT_SIZE, + }); + // currently the elements returned from the parser are in a "skeleton" format + // which we need to convert to fully qualified excalidraw elements first + const excalidrawElements = convertToExcalidrawElements(elements); + + // Render elements and files on Excalidraw +} catch (e) { + // Error handling +} +``` + +## Playground + + Try it out [here](https://mermaid-to-excalidraw.vercel.app) + diff --git a/dev-docs/docs/introduction/get-started.mdx b/dev-docs/docs/introduction/get-started.mdx index f122c9a7..c5d9ab08 100644 --- a/dev-docs/docs/introduction/get-started.mdx +++ b/dev-docs/docs/introduction/get-started.mdx @@ -14,3 +14,4 @@ These docs are focused on developers, and structured in the following way: - [Introduction](/docs/) — development setup and introduction. - [@excalidraw/excalidraw](/docs/@excalidraw/excalidraw/installation) — docs for the npm package to help you integrate Excalidraw into your own app. - Editor — IN PROGRESS. Docs describing the internals of the Excalidraw editor to help in contributing to the codebase. +- [@excalidraw/mermaid-to-excalidraw](/docs/@excalidraw/mermaid-to-excalidraw/installation) - Docs for the mermaid to excalidraw parser diff --git a/dev-docs/sidebars.js b/dev-docs/sidebars.js index 7e3c95b4..4ff33746 100644 --- a/dev-docs/sidebars.js +++ b/dev-docs/sidebars.js @@ -23,6 +23,7 @@ const sidebars = { }, items: ["introduction/development", "introduction/contributing"], }, + { type: "category", label: "Codebase", items: ["codebase/json-schema"] }, { type: "category", label: "@excalidraw/excalidraw", @@ -93,8 +94,37 @@ const sidebars = { }, { type: "category", - label: "Codebase", - items: ["codebase/json-schema"], + label: "@excalidraw/mermaid-to-excalidraw", + link: { + type: "doc", + id: "@excalidraw/mermaid-to-excalidraw/installation", + }, + items: [ + "@excalidraw/mermaid-to-excalidraw/api", + "@excalidraw/mermaid-to-excalidraw/development", + { + type: "category", + label: "Codebase", + link: { + type: "doc", + id: "@excalidraw/mermaid-to-excalidraw/codebase/codebase", + }, + items: [ + { + type: "category", + label: "How Parser works under the hood?", + link: { + type: "doc", + id: "@excalidraw/mermaid-to-excalidraw/codebase/parser/parser", + }, + items: [ + "@excalidraw/mermaid-to-excalidraw/codebase/parser/flowchart", + ], + }, + "@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type", + ], + }, + ], }, ], }; diff --git a/dev-docs/src/theme/ReactLiveScope/index.js b/dev-docs/src/theme/ReactLiveScope/index.js index e5263e1d..7464db22 100644 --- a/dev-docs/src/theme/ReactLiveScope/index.js +++ b/dev-docs/src/theme/ReactLiveScope/index.js @@ -25,6 +25,7 @@ const ExcalidrawScope = { exportToCanvas: ExcalidrawComp.exportToCanvas, initialData, useI18n: ExcalidrawComp.useI18n, + convertToExcalidrawElements: ExcalidrawComp.convertToExcalidrawElements, }; export default ExcalidrawScope; diff --git a/src/packages/excalidraw/.size-limit.json b/src/packages/excalidraw/.size-limit.json index e2538635..1b953f30 100644 --- a/src/packages/excalidraw/.size-limit.json +++ b/src/packages/excalidraw/.size-limit.json @@ -1,7 +1,7 @@ [ { "path": "dist/excalidraw.production.min.js", - "limit": "291 kB" + "limit": "305 kB" }, { "path": "dist/excalidraw-assets/locales",