|
| 1 | +# Mermaid Diagram Web Part for SharePoint Online |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +I created this web part to add **Mermaid diagram support** in SharePoint Online as part of my tutorial series. While working on it, I found this discussion thread: [Displaying Mermaid Diagrams in SharePoint Online Markdown Web Parts](https://techcommunity.microsoft.com/discussions/sharepoint_general/displaying-mermaid-diagrams-in-sharepoint-online-markdown-web-parts/4043819), which highlights the need for a proper solution. |
| 6 | + |
| 7 | +Since the native **Markdown web part in SharePoint Online does not support Mermaid diagrams**, I built this SPFx web part to enable rendering Mermaid syntax directly. I'm sharing this in case others find it useful or have suggestions for improvements. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Compatibility |
| 12 | + |
| 13 | +| :warning: Important | |
| 14 | +|:---------------------------| |
| 15 | +| Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to build this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.| |
| 16 | +|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. | |
| 17 | + |
| 18 | +This sample is optimally compatible with the following environment configuration: |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1") |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +## Applies to |
| 30 | + |
| 31 | +- [SharePoint Framework](https://aka.ms/spfx) |
| 32 | +- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant) |
| 33 | + |
| 34 | +> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram) |
| 35 | +
|
| 36 | + |
| 37 | +## Version history |
| 38 | + |
| 39 | +| Version | Date | Comments | |
| 40 | +| ------- | ---------------- | --------------- | |
| 41 | +| 1.0 | March 16, 2025 | Initial release | |
| 42 | + |
| 43 | + |
| 44 | +## Contributors |
| 45 | + |
| 46 | +- [Clavin Fernandes](https://github.com/cfernandes-muhimbi) |
| 47 | + |
| 48 | + |
| 49 | +## Minimal path to awesome |
| 50 | + |
| 51 | + |
| 52 | +- Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/js-mermaid-diagram) then unzip it) |
| 53 | +- From your command line, change your current directory to the directory containing this sample (`js-mermaid-diagram`, located under `samples`) |
| 54 | +- in the command line run: |
| 55 | + - `npm install` |
| 56 | + - `gulp serve` |
| 57 | + |
| 58 | +> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit <https://aka.ms/spfx-devcontainer> for further instructions. |
| 59 | +
|
| 60 | + |
| 61 | +## Features |
| 62 | + |
| 63 | +- Render **Mermaid.js** diagrams in SharePoint Online |
| 64 | +- Supports flowcharts, sequence diagrams, Gantt charts, and more |
| 65 | +- Easy integration with existing SharePoint pagesShare your web part with others through Microsoft 365 Patterns and Practices program to get visibility and exposure. More details on the community, open-source projects and other activities from http://aka.ms/m365pnp. |
| 66 | + |
| 67 | +Happy diagramming! |
| 68 | + |
| 69 | +## References |
| 70 | + |
| 71 | +- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant) |
| 72 | +- [Building for Microsoft teams](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/build-for-teams-overview) |
| 73 | +- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis) |
| 74 | +- [Publish SharePoint Framework applications to the Marketplace](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/publish-to-marketplace-overview) |
| 75 | +- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development |
| 76 | + |
| 77 | +## Help |
| 78 | + |
| 79 | +We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues. |
| 80 | + |
| 81 | +If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment. |
| 82 | + |
| 83 | +You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-webparts/issues?q=label%3A%22sample%3A%20js-mermaid-diagram%22) to see if anybody else is having the same issues. |
| 84 | + |
| 85 | +You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-webparts/discussions?discussions_q=js-mermaid-diagram) and see what the community is saying. |
| 86 | + |
| 87 | +If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20js-mermaid-diagram&template=bug-report.yml&sample=js-mermaid-diagram&authors=@cfernandes-muhimbi&title=js-mermaid-diagram%20-%20). |
| 88 | + |
| 89 | +For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20js-mermaid-diagram&template=question.yml&sample=js-mermaid-diagram&authors=@cfernandes-muhimbi&title=js-mermaid-diagram%20-%20). |
| 90 | + |
| 91 | +Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20js-mermaid-diagram&template=suggestion.yml&sample=js-mermaid-diagram&authors=@cfernandes-muhimbi&title=js-mermaid-diagram%20-%20). |
| 92 | + |
| 93 | +## Disclaimer |
| 94 | + |
| 95 | +**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** |
| 96 | + |
| 97 | +<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/js-mermaid-diagram" /> |
| 98 | + |
0 commit comments