-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
404 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import { imgSnapshotTest } from '../../helpers/util.ts'; | ||
|
||
describe('Kanban diagram', () => { | ||
it('1: should render a kanban with a single section', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
docs[Create Blog about the new diagram] | ||
`, | ||
{} | ||
); | ||
}); | ||
it('2: should render a kanban with multiple sections', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
id2 | ||
docs[Create Blog about the new diagram] | ||
`, | ||
{} | ||
); | ||
}); | ||
it('3: should render a kanban with a single wrapping node', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char, wrapping] | ||
`, | ||
{} | ||
); | ||
}); | ||
it('4: should handle the height of a section with a wrapping node at the end', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
id2[One line] | ||
id3[Title of diagram is more than 100 chars when user duplicates diagram with 100 char, wrapping] | ||
`, | ||
{} | ||
); | ||
}); | ||
it('5: should handle the height of a section with a wrapping node at the top', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char, wrapping] | ||
id3[One line] | ||
`, | ||
{} | ||
); | ||
}); | ||
it('6: should handle the height of a section with a wrapping node in the middle', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
id2[One line] | ||
id3[Title of diagram is more than 100 chars when user duplicates diagram with 100 char, wrapping] | ||
id4[One line] | ||
`, | ||
{} | ||
); | ||
}); | ||
it('6: should handle assigments', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
id2[In progress] | ||
docs[Create Blog about the new diagram]@{ assigned: 'knsv' } | ||
`, | ||
{} | ||
); | ||
}); | ||
it('7: should handle prioritization', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id2[In progress] | ||
vh[Very High]@{ priority: 'Very High' } | ||
h[High]@{ priority: 'High' } | ||
m[Default priority] | ||
l[Low]@{ priority: 'Low' } | ||
vl[Very Low]@{ priority: 'Very Low' } | ||
`, | ||
{} | ||
); | ||
}); | ||
it('7: should handle external tickets', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
id2[In progress] | ||
docs[Create Blog about the new diagram]@{ ticket: MC-2037 } | ||
`, | ||
{} | ||
); | ||
}); | ||
it('8: should handle assignments, prioritization and tickets ids in the same item', () => { | ||
imgSnapshotTest( | ||
`kanban | ||
id2[In progress] | ||
docs[Create Blog about the new diagram]@{ priority: 'Very Low', ticket: MC-2037, assigned: 'knsv' } | ||
`, | ||
{} | ||
); | ||
}); | ||
it('10: Full example', () => { | ||
imgSnapshotTest( | ||
`--- | ||
config: | ||
kanban: | ||
ticketBaseUrl: 'https://abc123.atlassian.net/browse/#TICKET#' | ||
--- | ||
kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
docs[Create Blog about the new diagram] | ||
id7[In progress] | ||
id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.] | ||
id8[Design grammar]@{ assigned: 'knsv' } | ||
id9[Ready for deploy] | ||
id10[Ready for test] | ||
id11[Done] | ||
id5[define getData] | ||
id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char]@{ ticket: MC-2036, priority: 'Very High'} | ||
id3[Update DB function]@{ ticket: MC-2037, assigned: knsv, priority: 'High' } | ||
id4[Create parsing tests]@{ ticket: MC-2038, assigned: 'K.Sveidqvist', priority: 'High' } | ||
id66[last item]@{ priority: 'Very Low', assigned: 'knsv' } | ||
id12[Can't reproduce] | ||
`, | ||
{} | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
> **Warning** | ||
> | ||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. | ||
> | ||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/kanban.md](../../packages/mermaid/src/docs/syntax/kanban.md). | ||
# Mermaid Kanban Diagram Documentation | ||
|
||
Mermaid’s Kanban diagram allows you to create visual representations of tasks moving through different stages of a workflow. This guide explains how to use the Kanban diagram syntax, based on the provided example. | ||
|
||
## Overview | ||
|
||
A Kanban diagram in Mermaid starts with the kanban keyword, followed by the definition of columns (stages) and tasks within those columns. | ||
|
||
```mermaid-example | ||
kanban | ||
column1[Column Title] | ||
task1[Task Description] | ||
``` | ||
|
||
```mermaid | ||
kanban | ||
column1[Column Title] | ||
task1[Task Description] | ||
``` | ||
|
||
## Defining Columns | ||
|
||
Columns represent the different stages in your workflow, such as “Todo,” “In Progress,” “Done,” etc. Each column is defined using a unique identifier and a title enclosed in square brackets. | ||
|
||
**Syntax:** | ||
|
||
``` | ||
columnId[Column Title] | ||
``` | ||
|
||
- columnId: A unique identifier for the column. | ||
- \[Column Title]: The title displayed on the column header. | ||
|
||
Like this `id1[Todo]` | ||
|
||
## Adding Tasks to Columns | ||
|
||
Tasks are listed under their respective columns with an indentation. Each task also has a unique identifier and a description enclosed in square brackets. | ||
|
||
**Syntax:** | ||
|
||
``` | ||
taskId[Task Description] | ||
``` | ||
|
||
``` | ||
• taskId: A unique identifier for the task. | ||
• [Task Description]: The description of the task. | ||
``` | ||
|
||
**Example:** | ||
|
||
``` | ||
docs[Create Documentation] | ||
``` | ||
|
||
## Adding Metadata to Tasks | ||
|
||
You can include additional metadata for each task using the @{ ... } syntax. Metadata can contain key-value pairs like assigned, ticket, priority, etc. This will be rendered added to the rendering of the node. | ||
|
||
## Supported Metadata Keys | ||
|
||
``` | ||
• assigned: Specifies who is responsible for the task. | ||
• ticket: Links the task to a ticket or issue number. | ||
• priority: Indicates the urgency of the task (e.g., ‘Very High’,‘High’, ‘Low’, ‘Very Low’). | ||
``` | ||
|
||
```mermaid-example | ||
kanban | ||
todo[Todo] | ||
id3[Update Database Function]@{ ticket: MC-2037, assigned: 'knsv', priority: 'High' } | ||
``` | ||
|
||
```mermaid | ||
kanban | ||
todo[Todo] | ||
id3[Update Database Function]@{ ticket: MC-2037, assigned: 'knsv', priority: 'High' } | ||
``` | ||
|
||
## Configuration Options | ||
|
||
You can customize the Kanban diagram using a configuration block at the beginning of your markdown file. This is useful for setting global settings like a base URL for tickets. Currently there is one configuration option for kanban diagrams tacketBaseUrl. This can be set as in the the following example: | ||
|
||
```yaml | ||
--- | ||
config: | ||
kanban: | ||
ticketBaseUrl: 'https://yourproject.atlassian.net/browse/#TICKET#' | ||
--- | ||
``` | ||
|
||
When the kanban item has an assigned ticket number the ticket number in the diagram will have a link to an external system where the ticket is defined. The `ticketBaseUrl` sets the base URL to the external system and #TICKET# is replaced with the ticket value from task metadata to create a valid link. | ||
|
||
## Full Example | ||
|
||
Below is the full Kanban diagram based on the provided example: | ||
|
||
```mermaid-example | ||
--- | ||
config: | ||
kanban: | ||
ticketBaseUrl: 'https://mermaidchart.atlassian.net/browse/#TICKET#' | ||
--- | ||
kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
blog[Write Blog Post About New Diagram] | ||
id7[In Progress] | ||
renderer[Develop Universal Renderer] | ||
grammar[Design Grammar]@{ assigned: 'knsv' } | ||
id9[Ready for Deploy] | ||
id10[Ready for Test] | ||
id11[Done] | ||
getData[Define getData Function] | ||
longTitle[Handle Long Diagram Titles]@{ ticket: MC-2036, priority: 'Very High' } | ||
dbUpdate[Update Database Function]@{ ticket: MC-2037, assigned: 'knsv', priority: 'High' } | ||
parsingTests[Create Parsing Tests]@{ ticket: MC-2038, assigned: 'K. Sveidqvist', priority: 'High' } | ||
lastItem[Finalize Last Item]@{ priority: 'Very Low', assigned: 'knsv' } | ||
id12[Can't Reproduce] | ||
``` | ||
|
||
```mermaid | ||
--- | ||
config: | ||
kanban: | ||
ticketBaseUrl: 'https://mermaidchart.atlassian.net/browse/#TICKET#' | ||
--- | ||
kanban | ||
id1[Todo] | ||
docs[Create Documentation] | ||
blog[Write Blog Post About New Diagram] | ||
id7[In Progress] | ||
renderer[Develop Universal Renderer] | ||
grammar[Design Grammar]@{ assigned: 'knsv' } | ||
id9[Ready for Deploy] | ||
id10[Ready for Test] | ||
id11[Done] | ||
getData[Define getData Function] | ||
longTitle[Handle Long Diagram Titles]@{ ticket: MC-2036, priority: 'Very High' } | ||
dbUpdate[Update Database Function]@{ ticket: MC-2037, assigned: 'knsv', priority: 'High' } | ||
parsingTests[Create Parsing Tests]@{ ticket: MC-2038, assigned: 'K. Sveidqvist', priority: 'High' } | ||
lastItem[Finalize Last Item]@{ priority: 'Very Low', assigned: 'knsv' } | ||
id12[Can't Reproduce] | ||
``` | ||
|
||
In conclusion, creating a Kanban diagram in Mermaid is a straightforward process that effectively visualizes your workflow. Start by using the kanban keyword to initiate the diagram. Define your columns with unique identifiers and titles to represent different stages of your project. Under each column, list your tasks—also with unique identifiers—and provide detailed descriptions as needed. Remember that proper indentation is crucial; tasks must be indented under their parent columns to maintain the correct structure. | ||
|
||
You can enhance your diagram by adding optional metadata to tasks using the @{ ... } syntax, which allows you to include additional context such as assignee, ticket numbers, and priority levels. For further customization, utilize the configuration block at the top of your file to set global options like ticketBaseUrl for linking tickets directly from your diagram. | ||
|
||
By adhering to these guidelines—ensuring unique identifiers, proper indentation, and utilizing metadata and configuration options—you can create a comprehensive and customized Kanban board that effectively maps out your project’s workflow using Mermaid. |
Oops, something went wrong.