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

Cannot center-justify text in nodes #958

Closed
elenigen opened this issue Sep 27, 2019 · 7 comments
Closed

Cannot center-justify text in nodes #958

elenigen opened this issue Sep 27, 2019 · 7 comments
Assignees
Labels

Comments

@elenigen
Copy link

Describe the bug
I'm basically reopening this issue: #397 because the original solution is no longer working and the discussion thread has been blocked.

To Reproduce
Steps to reproduce the behavior:

graph LR;

A[<center>My centered text</center>]-->B[<center>Some other text<br>with a line break</center>]

Try here

Expected behavior
We can see that <br> html tag was properly rendered, but the <center> tag isn't. We would need a native solution (without <script> tag) to allow this to work (not necessarily <center>, it could be done with style operation for instance.

Screenshots
image

Desktop/Mobile

@elenigen elenigen added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Sep 27, 2019
@IOrlandoni
Copy link
Member

IOrlandoni commented Sep 27, 2019

Note that the <center> tag has been deprecated latest versions of HTML so I'm not sure if you will get the expected result but, if you want to avoid escaping and actually have a tag, you have to change the security level.

See here.

@IOrlandoni IOrlandoni added Contributor needed Type: Other Not an enhancement or a bug and removed Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Sep 27, 2019
@elenigen
Copy link
Author

Sounds like a broken feature, if you have to disable the security, no?

If we are not supposed to use <center>, then it should not be the solution. Why not allowing this through the style operation as I recommended?

@elenigen
Copy link
Author

Just to be clear, I use mermaid in my github wikis and there's no way to put this extra config, specially I use a Chrome plugin to render it dynamically. It really sounds like a missing/broken feature.

@IOrlandoni
Copy link
Member

IOrlandoni commented Sep 27, 2019

Hey, my answer was only directed to the fact that the tag gets written as text in the node instead of actually being a tag. This is because you are working on strict security level.

Also the fact that the <center> tag is not in use, so you might not get the desired results.

This does not provide a solution to how to center-justify text in nodes and, it appers to be, there is none. It's just a missing feature. Even when using the text-align on a style operation, it sets it but it does not work. See here.

@IOrlandoni IOrlandoni added Area: Development Status: Pending Is not to be executed as it currently is Type: Enhancement New feature or request and removed Type: Other Not an enhancement or a bug Contributor needed labels Sep 27, 2019
@knsv
Copy link
Collaborator

knsv commented Sep 30, 2019

I think we should investigate this one further. Maybe something like this:

graph LR;

A[My centered text].center

What needs to be investigated is if there is some nifty css to align the text. When using htmlLabels this should be possible. Note that the dot notation means tha the class is attached to the node.

@knsv knsv added Graph: Flow Good first issue! Status: Approved Is ready to be worked on and removed Status: Pending Is not to be executed as it currently is labels Sep 30, 2019
@IOrlandoni
Copy link
Member

I think the issue lays in the fact that style properties are applied only to the "node" (rect, box, etc...) and so they don't affect the label which is not inside the "node".

Sample with textAlign center style:
image

KoljaTM pushed a commit to edekadigital/mermaid that referenced this issue Oct 14, 2019
- assign text-align style to text node to allow aligning of node text
@KoljaTM
Copy link

KoljaTM commented Oct 14, 2019

The "color" property is already applied at the text node level. I added that for text-align as well in a PR.

KoljaTM pushed a commit to edekadigital/mermaid that referenced this issue Oct 14, 2019
- changed fit() to it() to reactivate test
KoljaTM pushed a commit to edekadigital/mermaid that referenced this issue Oct 15, 2019
- assign text-align style to text node to allow aligning of node text
KoljaTM pushed a commit to edekadigital/mermaid that referenced this issue Oct 15, 2019
- changed fit() to it() to reactivate test
knsv added a commit that referenced this issue Oct 15, 2019
#958 Cannot center-justify text in nodes
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants