generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2382 from obsidian-tasks-group/encode-entities-in…
…-mermaid fix: Correct (unreleased) display of special chars in Mermaid status diagrams
- Loading branch information
Showing
18 changed files
with
308 additions
and
198 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
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
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,37 @@ | ||
/** | ||
* Convert any single reserved HTML character to its entity name. | ||
* @param character | ||
* | ||
* @see htmlEncodeString | ||
*/ | ||
export function htmlEncodeCharacter(character: string) { | ||
const charactersToEntityNames: { [index: string]: string } = { | ||
'<': '<', | ||
'>': '>', | ||
'&': '&', | ||
'"': '"', | ||
}; | ||
|
||
const candidateEntityName = charactersToEntityNames[character]; | ||
if (candidateEntityName !== undefined) { | ||
return candidateEntityName; | ||
} | ||
|
||
return character; | ||
} | ||
|
||
/** | ||
* Convert reserved HTML characters to their entity names. | ||
* @param characters | ||
* | ||
* @see htmlEncodeCharacter | ||
*/ | ||
export function htmlEncodeString(characters: string) { | ||
const chars = [...characters]; | ||
let result = ''; | ||
chars.forEach((c) => { | ||
result += htmlEncodeCharacter(c); | ||
}); | ||
|
||
return result; | ||
} |
4 changes: 2 additions & 2 deletions
4
...s/DocsSamplesForStatuses.test.DefaultStatuses_core-statuses.approved.mermaid.md
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
|
||
```mermaid | ||
flowchart LR | ||
1[Todo] | ||
2[Done] | ||
1["Todo"] | ||
2["Done"] | ||
1 --> 2 | ||
2 --> 1 | ||
``` |
4 changes: 2 additions & 2 deletions
4
...DocsSamplesForStatuses.test.DefaultStatuses_custom-statuses.approved.mermaid.md
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
```mermaid | ||
flowchart LR | ||
1[In Progress] | ||
2[Cancelled] | ||
1["In Progress"] | ||
2["Cancelled"] | ||
``` |
6 changes: 3 additions & 3 deletions
6
...DocsSamplesForStatuses.test.DefaultStatuses_important-cycle.approved.mermaid.md
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
4 changes: 2 additions & 2 deletions
4
...s/DocsSamplesForStatuses.test.DefaultStatuses_pro-con-cycle.approved.mermaid.md
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
|
||
```mermaid | ||
flowchart LR | ||
1[Pro] | ||
2[Con] | ||
1["Pro"] | ||
2["Con"] | ||
1 --> 2 | ||
2 --> 1 | ||
``` |
6 changes: 3 additions & 3 deletions
6
...mplesForStatuses.test.DefaultStatuses_todo-in_progress-done.approved.mermaid.md
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
10 changes: 5 additions & 5 deletions
10
...SamplesForStatuses.test.DefaultStatuses_toggle-does-nothing.approved.mermaid.md
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
56 changes: 28 additions & 28 deletions
56
...nSamples/DocsSamplesForStatuses.test.Theme_AnuPpuccin_Table.approved.mermaid.md
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
38 changes: 19 additions & 19 deletions
38
...ntationSamples/DocsSamplesForStatuses.test.Theme_Aura_Table.approved.mermaid.md
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
16 changes: 8 additions & 8 deletions
16
...ples/DocsSamplesForStatuses.test.Theme_Ebullientworks_Table.approved.mermaid.md
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
Oops, something went wrong.