Skip to content

Add the border parameter in the image definition #101

@maximeflya

Description

@maximeflya

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions