Skip to content

Commit

Permalink
feat: In mermaid blocks replace \n with <br/>
Browse files Browse the repository at this point in the history
- Makes writing diagrams more convenient
- Matches how github flavored markdown handles mermaid blocks
- This was brought up in #140
  • Loading branch information
redimp committed Sep 29, 2024
1 parent 003975a commit 0d52932
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions otterwiki/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def block_code(self, code, info=None):
html = "".join(
["\\[{}\\]".format(line) for line in code.strip().splitlines()]
)
# replace \n with <br/> for convinient diagram writing (and match the github syntax)
code = code.replace("\\n","<br/>")
return '\n<pre class="mermaid">{}</pre>\n'.format(
code.strip()
)
Expand Down

0 comments on commit 0d52932

Please sign in to comment.