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

How to centre diagram? #26

Closed
xd009642 opened this issue Feb 27, 2022 · 4 comments
Closed

How to centre diagram? #26

xd009642 opened this issue Feb 27, 2022 · 4 comments

Comments

@xd009642
Copy link

I might be missing something, I was just wondering if there's an easy way to centre the diagram on the page? I tried applying the center=true attribute in dot itself but it's still left aligned. I also tried placing a <div align="center"></div> around the code block but that didn't work - it caused the graphviz text to be mangled in the body.

@dylanowen
Copy link
Owner

For the garbled text I believe you need an empty line after the <div>, this might be a bug on my end or a quirk of common mark.

Using that I was able to center diagrams smaller than the body using <div style="display: block; text-align: center">. I'm sure there is a better way though especially if you want to center diagrams larger than the containing block.

@xd009642
Copy link
Author

xd009642 commented Mar 2, 2022

Oh beautiful that worked for my use case, I'm happy with this being closed unless you want to keep it open to track any improvements to the existing behaviour. It would be nice if it just worked but a mention in the readme or a troubleshooting section would also probably work for most users

@mmicu
Copy link
Contributor

mmicu commented May 2, 2024

What if you add a class to the div? So it would be easier to write a css to center all of them. Otherwise, it would be quite annoying to add the same stil for all of them.

@Cypher1
Copy link
Collaborator

Cypher1 commented Aug 10, 2024

I believe this has been resolved but please reopen if needed.

@Cypher1 Cypher1 closed this as completed Aug 10, 2024
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

4 participants