Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensitivity to spaces #84

Open
fuelen opened this issue Mar 11, 2022 · 5 comments
Open

Sensitivity to spaces #84

fuelen opened this issue Mar 11, 2022 · 5 comments

Comments

@fuelen
Copy link

fuelen commented Mar 11, 2022

Dot format is sensitive to spaces. Quote from https://graphviz.org/doc/info/shapes.html#html

As is obvious from the above description, the interpretation of white space characters is one place where HTML-like labels is very different from standard HTML. In HTML, any sequence of white space characters is collapsed to a single space, If the user does not want this to happen, the input must use non-breaking spaces  . This makes sense in HTML, where text layout depends dynamically on the space available. In Graphviz, the layout is statically determined by the input, so it is reasonable to treat ordinary space characters as non-breaking. In addition, ignoring tabs and newlines allows the input text to be formatted for easier reading.

ERD diagram in DOT format
digraph {
  ranksep=1.0; rankdir=LR;
  node [shape = none, fontname="Roboto Mono"];
  "Blog.Comment" [label= <<table align='left' border='1' style='rounded' cellspacing='0' cellpadding='4' cellborder='0'><tr><td port='header@schema_module'><font point-size='18'>   Blog.Comment   </font></td></tr><tr><td border='1' sides='b' colspan='2'><font point-size='14'><i>comments</i></font></td></tr><tr><td align='left' port='field@id'>:id              <i><font color='gray54'>:id                 </font></i></td></tr><tr><td align='left' port='field@text'>:text            <i><font color='gray54'>:string             </font></i></td></tr><tr><td align='left' port='field@inserted_at'>:inserted_at     <i><font color='gray54'>:naive_datetime     </font></i></td></tr><tr><td align='left' port='field@updated_at'>:updated_at      <i><font color='gray54'>:naive_datetime     </font></i></td></tr><tr><td align='left' port='field@post_id'>:post_id         <i><font color='gray54'>:id                 </font></i></td></tr><tr><td align='left' port='field@user_id'>:user_id         <i><font color='gray54'>:id                 </font></i></td></tr></table>>]
  "Blog.Post" [label= <<table align='left' border='1' style='rounded' cellspacing='0' cellpadding='4' cellborder='0'><tr><td port='header@schema_module'><font point-size='18'>   Blog.Post   </font></td></tr><tr><td border='1' sides='b' colspan='2'><font point-size='14'><i>posts</i></font></td></tr><tr><td align='left' port='field@id'>:id              <i><font color='gray54'>:id                 </font></i></td></tr><tr><td align='left' port='field@title'>:title           <i><font color='gray54'>:string             </font></i></td></tr><tr><td align='left' port='field@text'>:text            <i><font color='gray54'>:string             </font></i></td></tr><tr><td align='left' port='field@inserted_at'>:inserted_at     <i><font color='gray54'>:naive_datetime     </font></i></td></tr><tr><td align='left' port='field@updated_at'>:updated_at      <i><font color='gray54'>:naive_datetime     </font></i></td></tr><tr><td align='left' port='field@user_id'>:user_id         <i><font color='gray54'>:id                 </font></i></td></tr></table>>]
  "Blog.User" [label= <<table align='left' border='1' style='rounded' cellspacing='0' cellpadding='4' cellborder='0'><tr><td port='header@schema_module'><font point-size='18'>   Blog.User   </font></td></tr><tr><td border='1' sides='b' colspan='2'><font point-size='14'><i>users</i></font></td></tr><tr><td align='left' port='field@id'>:id        <i><font color='gray54'>:id         </font></i></td></tr><tr><td align='left' port='field@email'>:email     <i><font color='gray54'>:string     </font></i></td></tr></table>>]

  "Blog.Post":"field@id":e -> "Blog.Comment":"field@post_id":w
  "Blog.User":"field@id":e -> "Blog.Comment":"field@user_id":w
  "Blog.User":"field@id":e -> "Blog.Post":"field@user_id":w
}

This is how it looks if rendered with dot utility:
зображення

And this is a screenshot from VS code:
зображення

@bigbug
Copy link
Collaborator

bigbug commented Mar 11, 2022

Currently I don't have time to look into this. From what I remember we are not alternating the input in any way. So I can think of two possible sources:

  • Something within the underlying d3-graphviz (or we are using some api calls differently
  • something with the jQuery rerender due to the pan+zoom+highlight implementation

@bigbug
Copy link
Collaborator

bigbug commented Apr 15, 2022

The above given DOT source renders the spaces with our current release:
Screenshot 2022-04-15 at 14 21 34
@fuelen: Can you please verify or provide another example?

@fuelen
Copy link
Author

fuelen commented Apr 15, 2022

@bigbug I still have the same results in version 0.2.0

@bigbug
Copy link
Collaborator

bigbug commented Apr 15, 2022

What system are you on?

@fuelen
Copy link
Author

fuelen commented Apr 15, 2022

Arch Linux

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

No branches or pull requests

2 participants