tabatkins / railroad-diagrams

:steam_locomotive: A small JS+SVG library for drawing railroad syntax diagrams, like on JSON.org. Now with a Python port!
MIT License
1.66k stars 153 forks source link

Preserve whitespace in SVG text nodes. #68

Closed mebeim closed 5 years ago

mebeim commented 5 years ago

Currently, whitespace is not preserved in SGV <text> nodes, which leads to stuff like this being rendered.

Input:

Diagram(Terminal('"x"'), Terminal('"      y      "'))

Output:

output

Expected output:

expected output


The issue is solved simply by adding whitespace: pre to the CSS rules for SVG <text> nodes, which is what this PR does.