JonasDoesThings/mkdocs-exclude-unused-files

Excluding images with fragments

Closed this issue · 2 comments

Hello Jonas, thanks for this nice plugin!

Material Mkdocs use fragments on URL to select images using a theme to choose image, like:

![figure](assets/figure_black.png#only-light){: .center .shadow }
![figure](assets/figure_white.png#only-dark){: .center .shadow }

When a use these example:

INFO    -  found 2 unused assets
INFO    -  deleted 2 unused assets from final output

In debug mode mkdcos build -v:

INFO    -  found 2 unused assets
DEBUG   -  {'/tmp/mkdocs_d3510031/assets/figure_black.png', '/tmp/mkdocs_d3510031/assets/assets/figure_white.png'}

reference: https://squidfunk.github.io/mkdocs-material/reference/images/?h=image#light-and-dark-mode

Hey @dunossauro thanks for reporting!

I will release a new version today or tomorrow fixing this behavior and allowing to trim specific suffixes when looking for unused files.

"#only-light" and "#only-dark" will be added to the default-trimmed suffixes. It's probably too dangerous to trim all content after # for all files, since "#" is a valid filename-character. So I think a trim-list is a good alternative.

Closed in v1.3.0
Thanks for reporting :)