Handle CR-LF in mermaid #27

Merged
pseiko1989 merged 3 commits from main into main 2022-11-29 10:40:48 +00:00
pseiko1989 commented 2022-11-25 21:45:02 +00:00 (Migrated from github.com)

mermaid blocks containing CR LF are returned line by line from the parser instead
of as a complete code chunk for LF only.
We need to expand the span for each chunk we get.
After the closing ticks we replace the remaining \r\n with \n to have a consistent line ending
in the mermaid code at least.

fixes #26

mermaid blocks containing CR LF are returned line by line from the parser instead of as a complete code chunk for LF only. We need to expand the span for each chunk we get. After the closing ticks we replace the remaining \r\n with \n to have a consistent line ending in the mermaid code at least. fixes #26
badboy (Migrated from github.com) requested changes 2022-11-28 15:15:49 +00:00
@ -76,8 +77,15 @@ fn add_mermaid(content: &str) -> Result<String> {
}
badboy (Migrated from github.com) commented 2022-11-28 15:13:18 +00:00

Stray println.

Stray println. ```suggestion ```
@ -81,0 +85,4 @@
} else {
code_span = code_span.start..span.end;
}
badboy (Migrated from github.com) commented 2022-11-28 15:15:16 +00:00
        // We're in the code block. The text is what we want.
        // Code blocks can come in multiple text events.
```suggestion // We're in the code block. The text is what we want. // Code blocks can come in multiple text events. ```
badboy (Migrated from github.com) commented 2022-11-28 15:15:38 +00:00

Let's call this out in the comment, so I don't have to remember that when I read this in 3 months

Let's call this out in the comment, so I don't have to remember that when I read this in 3 months
badboy (Migrated from github.com) approved these changes 2022-11-29 10:37:42 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jer/mdbook-mermaid!27
No description provided.