scalameta / mdoc

Typechecked markdown documentation for Scala
https://scalameta.org/mdoc/
Apache License 2.0
394 stars 81 forks source link

Unavoidable image compressing when publishing a site built with Docusaurus to GH pages #833

Open danicheg opened 8 months ago

danicheg commented 8 months ago

Hey there. I found that every site under the Center organization has compressed images on their websites. I dug into the Docusaurus and mdoc and haven't found a way to workaround this. For example, in bloop: The original img: https://github.com/scalacenter/bloop/blob/main/website/static/img/build-tools-logos.png (37.7 KB) The actual on the site: https://github.com/scalacenter/bloop/blob/gh-pages/img/build-tools-logos.png (28.8 KB)

Set up

In my case, the mdoc version is 2.5.2 and the Docusaurus version is 1.14.7.

Some details

When publishing a site to Github pages, the publish-gh-pages script ignores the options passed to the docusaurus-build (--skip-image-compression in my case). Running docusaurusCreateSite from mdoc before docusaurusPublishGhpages also doesn't help. However, when running docusaurusCreateSite locally, docusaurus-build uses the passed options properly, and ./website/build/foo/img contains uncompressed images.

danicheg commented 7 months ago

I managed to solve the issue by changing a little bit the approach of publishing a website to GH pages — by using external Github Action instead of mdoc/docusaurusPublishGhpages. If one expresses interest, you can find the workflow for publishing here https://github.com/scalacenter/scalac-profiling/blob/42ea7396f0cdabf5ed5dd91f7aa3769537ef4870/.github/workflows/publish-website.yml

I will leave this issue open and delegate deciding to maintainers on whether something should be tweaked in the mdoc.