Add the possibility to override the filename via argument or environment variable
Author: jules-wmcCreated Aug 21, 2026Updated Aug 21, 2026
Hi,
We're using diagrams with https://github.com/zoni/mkdocs-diagrams
We would like to exclude the generated images from versioning. To do so we need the filenames to respect a certain pattern, and we don't want to rely on developers manually overriding the filenames in each diagram as it is error prone.
Could we add something to override the filename from the python scripts arguments:
if not filename:
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("--diagram-filename", type=str, default=None)
try:
args, _ = parser.parse_known_args(sys.argv[1:])
if args.diagram_filename:
filename = args.diagram_filenameOr from an environment variable.
Let me know if you like the idea, and what's your preferred implementation path. I would be happy to open a pull request.
Thanks for the great tool,
Source: mingrammer/diagrams