stable

Clone or download

Read-only

Introduce mermaid diagrams in trackers

Display mermaid diagrams as soon as they are enclosed in mermaid fenced blocks (```mermaid): * in markdown text fields * in markdown followup comments (To test: text field only, followup comment only, both) The diagrams are lazy loaded: code block is replaced only when they are in the viewport. If no mermaid diagram detected, the lib is not included to not clutter the assets on artifact page. Note: only the artifact view is done. Artifact modal will come later if needed. Script is located in core because we will need it for git. Git is not done directly in this patch because there is already prismjs. Mermaid does not live well with prismjs by default. It will be done in a dedicated commit. Part of request #19739: Add support of mermaid js diagrams Change-Id: I0194fa469ba04bc617287e0f3ef5f91f3edb13e5

Modified Files

Name
M plugins/tracker/include/Tracker/Artifact/Renderer/EditRenderer.class.php +10 −0 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Tracker_Artifact_ChangesetValue_Text.class.php +10 −3 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Tracker_Artifact_Changeset_Comment.class.php +7 −1 Go to diff View file
A src/common/Markdown/CodeBlockFeatures.php +29 −0 Go to diff View file
A src/common/Markdown/CodeBlockFeaturesExtension.php +69 −0 Go to diff View file
A src/common/Markdown/CodeBlockFeaturesOnPage.php +60 −0 Go to diff View file
M src/package-lock.json +644 −9 Go to diff View file
M src/package.json +1 −0 Go to diff View file
A src/scripts/mermaid/__snapshots__/replace-code-blocks-by-mermaid-diagrams.test.ts.snap +22 −0 Go to diff View file
A src/scripts/mermaid/id-generator.test.ts +35 −0 Go to diff View file
A src/scripts/mermaid/id-generator.ts +27 −0 Go to diff View file
A src/scripts/mermaid/index.ts +24 −0 Go to diff View file
A src/scripts/mermaid/mermaid.d.ts +27 −0 Go to diff View file
A src/scripts/mermaid/replace-code-blocks-by-mermaid-diagrams.test.ts +160 −0 Go to diff View file
A src/scripts/mermaid/replace-code-blocks-by-mermaid-diagrams.ts +100 −0 Go to diff View file
M src/themes/FlamingParrot/css/utils/_definitions.scss +1 −0 Go to diff View file
A src/themes/FlamingParrot/css/utils/_mermaid.scss +50 −0 Go to diff View file
M src/tsconfig.json +1 −0 Go to diff View file
M src/webpack.common.js +1 −0 Go to diff View file
A tests/unit/Tuleap/Markdown/CodeBlockFeaturesExtensionTest.php +140 −0 Go to diff View file
A tests/unit/Tuleap/Markdown/CodeBlockFeaturesOnPageTest.php +65 −0 Go to diff View file