Skip to content

Text renderer does not handle embedded newlines #2622

Closed

Description

@showermat

A minimal example:

a: "A\na"

When rendering to SVG, this appropriately renders to a box with two lines. The text ("ASCII") renderer does not appear to handle the newline specially at all, so the second line ends up outside the box:

 ┌────┐
 │    │
 │A
a │
 │    │
 └────┘

I know there are a lot of control and formatting characters in Unicode, but doesn't it make sense to specially handle at least some of these, such as the humble newline?

$ d2 --version
v0.7.1

Activity

  1. alixander commented on Aug 20, 2025

    @alixander
    Collaborator

    @bo-ku-ra I would appreciate keeping one issue per issue please, helps me track =)

  2. bo-ku-ra commented on Aug 20, 2025

    @bo-ku-ra
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions