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

Add the border parameter in the image definition #101

Open
maximeflya opened this issue Jul 8, 2024 · 1 comment
Open

Add the border parameter in the image definition #101

maximeflya opened this issue Jul 8, 2024 · 1 comment
Labels
feature-request New feature or request

Comments

@maximeflya
Copy link

Is your feature request related to a problem? Please describe.
When building my documentation, the distance between my figures and the following line is very small and it doesn't look good.

From the image below, you can see by selecting the image, that the image border is basically the same as the border of the elements

image

Describe the solution you'd like
It would be nice to implement the border parameter from drawio in the figure or image definition so that we could write the following code:

.. drawio-figure:: diagrams/program_flow.drawio
    :page-name: action_manager
    :border: 10
    :width: 100%
    :align: center

It should not be too much work as it is already available in the drawio cli:

Usage: drawio [options] [input file/folder]

Options:
  -V, --version                      output the version number
  -c, --create                       creates a new empty file if no file is passed
 [...]
  -b, --border <border>              sets the border width around the diagram (default: 0)
 [...]

Describe alternatives you've considered
I briefly tried to change my css config file with the border property similar to what you have here but it did nothing

img.drawio {
border: 0;
max-width: 100%;
}

If you know how to make this parameter work, that would also be a solution that I am satisfied with. The advantage with the border parameter in the figure definition is that it can be used on a per image basis.

Note
When hacking the module's code to add the border parameter,

        drawio_args = [
            binary_path,
            "--export",
            "--crop",
            "--border",
            "20",
            "--page-index",
            page_index,
            *scale_args,
            *extra_args,
            "--format",
            output_format,
            "--output",
            str(export_abspath),
            str(input_abspath),
        ]

I get the desired layout. Interestingly, the border is not applied around the whole image like I would expect. (In my case it is even better this way, but is this a bug from drawio cli?)
image

@maximeflya maximeflya added the feature-request New feature or request label Jul 8, 2024
@jdillard
Copy link
Collaborator

jdillard commented Jul 11, 2024

Nice! Since you've done a little hacking you should try making a PR!

If you know how to make this parameter work, that would also be a solution that I am satisfied with. The advantage with the border parameter in the figure definition is that it can be used on a per image basis.

It would probably be best to add an optional default border config value, and have the parameter override if provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants