Skip to content

Commit

Permalink
change html minifier, previous one breaks the markup
Browse files Browse the repository at this point in the history
  • Loading branch information
quarckster committed Jul 11, 2024
1 parent 7f15fbc commit 224c8c5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 52 deletions.
10 changes: 1 addition & 9 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
FROM docker.io/library/pypy:3.10-slim-bookworm as BASE

RUN apt-get update && \
apt-get install -y curl gcc

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

ENV PATH=/root/.cargo/bin:/docs_venv/bin:$PATH

RUN rustup install 1.79.0
apt-get install -y gcc

COPY requirements.txt /requirements.txt

Expand All @@ -34,5 +28,3 @@ ENV PATH=/docs_venv/bin:$PATH \
RUN useradd -m openssl-docs

USER openssl-docs

RUN git config --global --add safe.directory "*"
14 changes: 3 additions & 11 deletions hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import shutil
from pathlib import Path

import minify_html
import htmlmin
from mkdocs import plugins
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.files import Files
Expand Down Expand Up @@ -146,13 +146,5 @@ def on_nav(nav: Navigation, config: MkDocsConfig, files: Files) -> Navigation:
return nav


def on_post_page(output: str, page: Page, config: MkDocsConfig):
return minify_html.minify(
output,
do_not_minify_doctype=True,
ensure_spec_compliant_unquoted_attribute_values=True,
keep_spaces_between_attributes=True,
minify_css=True,
minify_js=True,
remove_processing_instructions=True,
)
def on_post_page(output: str, page: Page, config: MkDocsConfig) -> str:
return htmlmin.minify(output, remove_comments=True, remove_empty_space=True)
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mike==2.1.2
minify_html
htmlmin
mkdocs==1.6.0
mkdocs-material==9.5.27
37 changes: 6 additions & 31 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ babel==2.15.0 \
--hash=sha256:08706bdad8d0a3413266ab61bd6c34d0c28d6e1e7badf40a2cebe67644e2e1fb \
--hash=sha256:8daf0e265d05768bc6c7a314cf1321e9a123afc328cc635c18622a2f30a04413
# via mkdocs-material
certifi==2024.6.2 \
--hash=sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516 \
--hash=sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56
certifi==2024.7.4 \
--hash=sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b \
--hash=sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90
# via requests
charset-normalizer==3.3.2 \
--hash=sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027 \
Expand Down Expand Up @@ -116,6 +116,9 @@ ghp-import==2.1.0 \
--hash=sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619 \
--hash=sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343
# via mkdocs
htmlmin==0.1.12 \
--hash=sha256:50c1ef4630374a5d723900096a961cff426dff46b48f34d194a81bbe14eca178
# via -r requirements.in
idna==3.7 \
--hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \
--hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0
Expand Down Expand Up @@ -216,34 +219,6 @@ mike==2.1.2 \
--hash=sha256:d59cc8054c50f9c8a046cfd47f9b700cf9ff1b2b19f420bd8812ca6f94fa8bd3 \
--hash=sha256:d61d9b423ab412d634ca2bd520136d5114e3cc73f4bbd1aa6a0c6625c04918c0
# via -r requirements.in
minify-html==0.15.0 \
--hash=sha256:01ea40dc5ae073c47024f02758d5e18e55d853265eb9c099040a6c00ab0abb99 \
--hash=sha256:1056819ea46e9080db6fed678d03511c7e94c2a615e72df82190ea898dc82609 \
--hash=sha256:2a9aef71b24c3d38c6bece2db3bf707443894958b01f1c27d3a6459ba4200e59 \
--hash=sha256:3b38ea5b446cc69e691a0bf64d1160332ffc220bb5b411775983c87311cab2c7 \
--hash=sha256:40f38ddfefbb63beb28df20c2c81c12e6af6838387520506b4eceec807d794a3 \
--hash=sha256:597c86f9792437eee0698118fb38dff42b5b4be6d437b6d577453c2f91524ccc \
--hash=sha256:5f707b233b9c163a546b15ce9af433ddd456bd113f0326e5ffb382b8ee5c1a2d \
--hash=sha256:70251bd7174b62c91333110301b27000b547aa2cc06d4fe6ba6c3f11612eecc9 \
--hash=sha256:7a5eb7e830277762da69498ee0f15d4a9fa6e91887a93567d388e4f5aee01ec3 \
--hash=sha256:7af72438d3ae6ea8b0a94c038d35c9c22c5f8540967f5fa2487f77b2cdb12605 \
--hash=sha256:7b071ded7aacbb140a7e751d49e246052f204b896d69663a4a5c3a27203d27f6 \
--hash=sha256:7b2aadba6987e6c15a916a4627b94b1db3cbac65e6ae3613b61b3ab0d2bb4c96 \
--hash=sha256:7e6d4f97cebb725bc1075f225bdfcd824e0f5c20a37d9ea798d900f96e1b80c0 \
--hash=sha256:92375f0cb3b4074e45005e1b4708b5b4c0781b335659d52918671c083c19c71e \
--hash=sha256:a23a8055e65fa01175ddd7d18d101c05e267410fa5956c65597dcc332c7f91dd \
--hash=sha256:afd76ca2dc9afa53b66973a3a66eff9a64692811ead44102aa8044a37872e6e2 \
--hash=sha256:b6356541799951c5e8205aabf5970dda687f4ffa736479ce8df031919861e51d \
--hash=sha256:bd682207673246c78fb895e7065425cc94cb712d94cff816dd9752ce014f23e8 \
--hash=sha256:cda674cc68ec3b9ebf61f2986f3ef62de60ce837a58860c6f16b011862b5d533 \
--hash=sha256:cf4c36b6f9af3b0901bd2a0a29db3b09c0cdf0c38d3dde28e6835bce0f605d37 \
--hash=sha256:d4c4ae3909e2896c865ebaa3a96939191f904dd337a87d7594130f3dfca55510 \
--hash=sha256:dc2df1e5203d89197f530d14c9a82067f3d04b9cb0118abc8f2ef8f88efce109 \
--hash=sha256:e47197849a1c09a95892d32df3c9e15f6d0902c9ae215e73249b9f5bca9aeb97 \
--hash=sha256:ea315ad6ac33d7463fac3f313bba8c8d9a55f4811971c203eed931203047e5c8 \
--hash=sha256:ef6dc1950e04b7566c1ece72712674416f86fef8966ca026f6c5580d840cd354 \
--hash=sha256:f37ce536305500914fd4ee2bbaa4dd05a039f39eeceae45560c39767d99aede0
# via -r requirements.in
mkdocs==1.6.0 \
--hash=sha256:1eb5cb7676b7d89323e62b56235010216319217d4af5ddc543a91beb8d125ea7 \
--hash=sha256:a73f735824ef83a4f3bcb7a231dcab23f5a838f88b7efc54a0eef5fbdbc3c512
Expand Down

0 comments on commit 224c8c5

Please sign in to comment.