Skip to content

Commit b372a74

Browse files
authored
Merge pull request #5424 from cfernandes-muhimbi/cfernandes-spfx-branch
Cfernandes spfx branch
2 parents b2b862c + a1a749a commit b372a74

31 files changed

+30761
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "SPFx 1.20.0",
3+
"image": "docker.io/m365pnp/spfx:1.20.0",
4+
"customizations": {
5+
"vscode": {
6+
"extensions": [
7+
"editorconfig.editorconfig",
8+
"dbaeumer.vscode-eslint"
9+
]
10+
}
11+
},
12+
"forwardPorts": [
13+
4321,
14+
35729,
15+
5432
16+
],
17+
"portsAttributes": {
18+
"4321": {
19+
"protocol": "https",
20+
"label": "Manifest",
21+
"onAutoForward": "silent",
22+
"requireLocalPort": true
23+
},
24+
"5432": {
25+
"protocol": "https",
26+
"label": "Workbench",
27+
"onAutoForward": "silent"
28+
},
29+
"35729": {
30+
"protocol": "https",
31+
"label": "LiveReload",
32+
"onAutoForward": "silent",
33+
"requireLocalPort": true
34+
}
35+
},
36+
"postCreateCommand": "bash .devcontainer/spfx-startup.sh",
37+
"remoteUser": "node"
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
echo
2+
echo -e "\e[1;94mInstalling Node dependencies\e[0m"
3+
npm install
4+
5+
## commands to create dev certificate and copy it to the root folder of the project
6+
echo
7+
echo -e "\e[1;94mGenerating dev certificate\e[0m"
8+
gulp trust-dev-cert
9+
10+
# Convert the generated PEM certificate to a CER certificate
11+
openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer
12+
13+
# Copy the PEM ecrtificate for non-Windows hosts
14+
cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem
15+
16+
## add *.cer to .gitignore to prevent certificates from being saved in repo
17+
if ! grep -Fxq '*.cer' ./.gitignore
18+
then
19+
echo "# .CER Certificates" >> .gitignore
20+
echo "*.cer" >> .gitignore
21+
fi
22+
23+
## add *.pem to .gitignore to prevent certificates from being saved in repo
24+
if ! grep -Fxq '*.pem' ./.gitignore
25+
then
26+
echo "# .PEM Certificates" >> .gitignore
27+
echo "*.pem" >> .gitignore
28+
fi
29+
30+
echo
31+
echo -e "\e[1;92mReady!\e[0m"
32+
33+
echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********"

samples/js-mermaid-diagram/.eslintrc.js

+319
Large diffs are not rendered by default.

samples/js-mermaid-diagram/.gitignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Dependency directories
7+
node_modules
8+
9+
# Build generated files
10+
dist
11+
lib
12+
release
13+
solution
14+
temp
15+
*.sppkg
16+
.heft
17+
18+
# Coverage directory used by tools like istanbul
19+
coverage
20+
21+
# OSX
22+
.DS_Store
23+
24+
# Visual Studio files
25+
.ntvs_analysis.dat
26+
.vs
27+
bin
28+
obj
29+
30+
# Resx Generated Code
31+
*.resx.ts
32+
33+
# Styles Generated Code
34+
*.scss.ts

samples/js-mermaid-diagram/.npmignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
!dist
2+
config
3+
4+
gulpfile.js
5+
6+
release
7+
src
8+
temp
9+
10+
tsconfig.json
11+
tslint.json
12+
13+
*.log
14+
15+
.yo-rc.json
16+
.vscode

samples/js-mermaid-diagram/.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.20.3
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"@microsoft/generator-sharepoint": {
3+
"plusBeta": false,
4+
"isCreatingSolution": true,
5+
"nodeVersion": "18.20.3",
6+
"sdksVersions": {
7+
"@microsoft/microsoft-graph-client": "3.0.2",
8+
"@microsoft/teams-js": "2.24.0"
9+
},
10+
"version": "1.20.0",
11+
"libraryName": "spfx-mermaid-diagram",
12+
"libraryId": "c8a586df-9193-4d14-8156-0c2d46493604",
13+
"environment": "spo",
14+
"packageManager": "npm",
15+
"solutionName": "spfx-mermaid-diagram",
16+
"solutionShortDescription": "spfx-mermaid-diagram description",
17+
"skipFeatureDeployment": true,
18+
"isDomainIsolated": false,
19+
"componentType": "webpart"
20+
}
21+
}

samples/js-mermaid-diagram/README.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
![Mermaid](https://github.com/cfernandes-muhimbi/sp-dev-fx-webparts/blob/cfernandes-spfx-branch/samples/js-mermaid-diagram/assets/Mermaid.gif)
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+
![SPFx 1.20.2](https://img.shields.io/badge/SPFx-1.20.2-green.svg)
21+
![Node.js v18](https://img.shields.io/badge/Node.js-v18-green.svg)
22+
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
23+
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
24+
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
25+
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
26+
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
27+
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
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+
1.27 MB
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"name": "pnp-sp-dev-spfx-web-parts-js-mermaid-diagram",
4+
"source": "pnp",
5+
"title": "Mermaid Diagram Web Part for SharePoint Online",
6+
"shortDescription": "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, which highlights the need for a proper solution.",
7+
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/js-mermaid-diagram",
8+
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/js-mermaid-diagram",
9+
"longDescription": [
10+
"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, which highlights the need for a proper solution."
11+
],
12+
"creationDateTime": "2025-03-16",
13+
"updateDateTime": "2025-03-16",
14+
"products": [
15+
"SharePoint"
16+
],
17+
"metadata": [
18+
{
19+
"key": "CLIENT-SIDE-DEV",
20+
"value": "React"
21+
},
22+
{
23+
"key": "SPFX-VERSION",
24+
"value": "1.20.0"
25+
}
26+
],
27+
"thumbnails": [
28+
{
29+
"name": "js-mermaid.png",
30+
"type": "image",
31+
"order": 100,
32+
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/js-mermaid-diagram/assets/js-mermaid.png",
33+
"alt": "Web Part Preview"
34+
},
35+
{
36+
"name": "Mermaid.gif",
37+
"type": "image",
38+
"order": 101,
39+
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/js-mermaid-diagram/assets/Mermaid.gif",
40+
"alt": "Web Part Preview"
41+
}
42+
],
43+
"authors": [
44+
{
45+
"gitHubAccount": "https://github.com/cfernandes-muhimbi",
46+
"pictureUrl": "https://github.com/cfernandes-muhimbi.png",
47+
"name": "Clavin Fernandes"
48+
}
49+
],
50+
"references": [
51+
{
52+
"name": "Build your first SharePoint client-side web part",
53+
"description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.",
54+
"url": "https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part"
55+
}
56+
]
57+
}
58+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
3+
"version": "2.0",
4+
"bundles": {
5+
"spfx-mermaid-diagram-web-part": {
6+
"components": [
7+
{
8+
"entrypoint": "./lib/webparts/spfxMermaidDiagram/SpfxMermaidDiagramWebPart.js",
9+
"manifest": "./src/webparts/spfxMermaidDiagram/SpfxMermaidDiagramWebPart.manifest.json"
10+
}
11+
]
12+
}
13+
},
14+
"externals": {},
15+
"localizedResources": {
16+
"SpfxMermaidDiagramWebPartStrings": "lib/webparts/spfxMermaidDiagram/loc/{locale}.js"
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
3+
"workingDir": "./release/assets/",
4+
"account": "<!-- STORAGE ACCOUNT NAME -->",
5+
"container": "spfx-mermaid-diagram",
6+
"accessKey": "<!-- ACCESS KEY -->"
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
3+
"solution": {
4+
"name": "spfx-mermaid-diagram-client-side-solution",
5+
"id": "c8a586df-9193-4d14-8156-0c2d46493604",
6+
"version": "1.0.0.0",
7+
"includeClientSideAssets": true,
8+
"skipFeatureDeployment": true,
9+
"isDomainIsolated": false,
10+
"developer": {
11+
"name": "",
12+
"websiteUrl": "",
13+
"privacyUrl": "",
14+
"termsOfUseUrl": "",
15+
"mpnId": "Undefined-1.20.0"
16+
},
17+
"metadata": {
18+
"shortDescription": {
19+
"default": "spfx-mermaid-diagram description"
20+
},
21+
"longDescription": {
22+
"default": "spfx-mermaid-diagram description"
23+
},
24+
"screenshotPaths": [],
25+
"videoUrl": "",
26+
"categories": []
27+
},
28+
"features": [
29+
{
30+
"title": "spfx-mermaid-diagram Feature",
31+
"description": "The feature that activates elements of the spfx-mermaid-diagram solution.",
32+
"id": "27029121-b93a-4632-9b0a-23f7b49f350a",
33+
"version": "1.0.0.0"
34+
}
35+
]
36+
},
37+
"paths": {
38+
"zippedPackage": "solution/spfx-mermaid-diagram.sppkg"
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
3+
"port": 4321,
4+
"https": true,
5+
"initialPage": "https://044n7.sharepoint.com/_layouts/workbench.aspx"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
3+
"cdnBasePath": "<!-- PATH TO CDN -->"
4+
}

0 commit comments

Comments
 (0)