Skip to content

feat: enhance entityCodesToText to convert <br> tags to spaces#91

Open
akkilesh-a wants to merge 1 commit intoexcalidraw:masterfrom
akkilesh-a:br-tag-fix
Open

feat: enhance entityCodesToText to convert <br> tags to spaces#91
akkilesh-a wants to merge 1 commit intoexcalidraw:masterfrom
akkilesh-a:br-tag-fix

Conversation

@akkilesh-a
Copy link
Copy Markdown

The Problem

Mermaid Code

sequenceDiagram
    actor Customer
    participant ATM
    participant BankServer as "Bank Server / Database"

    Customer ->> ATM: Insert Card
    ATM ->> Customer: Prompt for PIN
    Customer ->> ATM: Enter PIN
    ATM ->> BankServer: Verify PIN
    BankServer -->> ATM: PIN Verified <br>/ Invalid PIN

    ATM ->> Customer: Display Transaction Options
    Customer ->> ATM: Select "Withdraw Cash"
    ATM ->> Customer: Prompt for Amount
    Customer ->> ATM: Enter Amount
    ATM ->> BankServer: Check Balance <br>and Authorize Transaction
    BankServer -->> ATM: Approval <br>/ Insufficient Funds

    ATM ->> ATM: Dispense Cash <br>(if approved)
    ATM ->> Customer: Deliver Cash <br>and Receipt
    ATM ->> BankServer: Update Account Balance
    BankServer -->> ATM: Acknowledgment

    ATM ->> Customer: Eject Card
    Customer -->> ATM: Take Card <br>and Exit

Current Mermaid to Excalidraw Output

Notice the
tags in the code and in the current diagram

image

Fixed Mermaid to Excalidraw Output

image

Fix Summary

  • Added <br>/<br/> tag parsing to entityCodesToText function
  • Wrap label text with entityCodesToText function
  • What the function does?
    • It parses through text labels with <br>/<br/> tags and changes them to " ", a simple space
  • Why not a newline?
    • Container boxes for nodes must be added with extra height for the new change in text and the whole excalidraw diagram would have be to readjusted to accommodate such a minor change
  • Added test too!

Closes #89

@vercel
Copy link
Copy Markdown

vercel Bot commented Nov 12, 2025

@akkilesh-a is attempting to deploy a commit to the Excalidraw Team on Vercel.

A member of the Team first needs to authorize it.

@akkilesh-a
Copy link
Copy Markdown
Author

akkilesh-a commented Nov 13, 2025

@ad1992 @dwelle @chunrapeepat can you please have a look at this?

@gabelevi
Copy link
Copy Markdown

I'd love to see this too. Though should <br/> turn into a newline instead of a space?

@akkilesh-a
Copy link
Copy Markdown
Author

I'd love to see this too. Though should <br/> turn into a newline instead of a space?

I'll work on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<br> tags being rendered into parsed output and rendered drawing

2 participants