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

Escape any HTML special characters in GraphViz HTML #230

Open
formatc1702 opened this issue Mar 23, 2021 · 1 comment
Open

Escape any HTML special characters in GraphViz HTML #230

formatc1702 opened this issue Mar 23, 2021 · 1 comment
Milestone

Comments

@formatc1702
Copy link
Collaborator

YAML and Python accept special characters (<, >, etc.) within strings without problems, but they cause issues when such a string is embedded inside the GraphViz HTML. Therefore, these characters should be escaped (&lt;, &gt;, etc.) when generating GraphViz HTML.

@kvid
Copy link
Collaborator

kvid commented Jan 30, 2022

We need clear rules on how to handle such characters when generating the different output formats, as they have different limitations:

  • .bom.tsv does not support TAB, CR or LF in the text fields. No hyperlinks or formatting tags are supported as such.
  • .gv designators have probably the same limitations as above, and also cannot contain characters that are interpreted as other syntax elements by Graphviz unless quoted.
  • .gv HTML in labels support a limited set of formatting tags and no hyperlinks in the text (only as table attributes). TAB, CR and LF might improve file readability, but regarded equal as space when rendered. <br/> is needed to force a linebreak. See doc.
  • .html support hyperlinks and a wider set of formatting tags. TAB, CR and LF might improve file readability, but regarded equal as space when rendered. <br/> is needed to force a linebreak.

I agree that we probably should escape HTML special characters and convert newline to <br/> (and perhaps
replace('\u00b2', '&sup2;')) for the two HTML output formats, but it should also be possible to disable all this when the user wants to include hyperlinks or some formatting tags, e.g. bold or italic to be used in the output formats that support them, and be filtered out in the other output formats (already partly implemented in #164). I guess we need a way to specify which of these two alternatives to apply for each input text attribute.

Is it possible to have a leading specifier flag in the attribute text to specify the non-default alternative? E.g. text attributes with a leading < character (or perhaps something like <!wireviz!> is better) to specify the second alternative.

See also #168 (comment)

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