mkdocs-minify-html-plugin 0.3.14__tar.gz → 0.3.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,9 +188,9 @@ checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79"
188
188
 
189
189
  [[package]]
190
190
  name = "crc32fast"
191
- version = "1.5.2"
191
+ version = "1.5.3"
192
192
  source = "registry+https://github.com/rust-lang/crates.io-index"
193
- checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
193
+ checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055"
194
194
  dependencies = [
195
195
  "cfg-if",
196
196
  ]
@@ -450,9 +450,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
450
450
 
451
451
  [[package]]
452
452
  name = "icu_collections"
453
- version = "2.3.0"
453
+ version = "2.4.0"
454
454
  source = "registry+https://github.com/rust-lang/crates.io-index"
455
- checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
455
+ checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd"
456
456
  dependencies = [
457
457
  "displaydoc",
458
458
  "potential_utf",
@@ -464,9 +464,9 @@ dependencies = [
464
464
 
465
465
  [[package]]
466
466
  name = "icu_locale_core"
467
- version = "2.3.0"
467
+ version = "2.4.0"
468
468
  source = "registry+https://github.com/rust-lang/crates.io-index"
469
- checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
469
+ checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0"
470
470
  dependencies = [
471
471
  "displaydoc",
472
472
  "litemap",
@@ -478,9 +478,9 @@ dependencies = [
478
478
 
479
479
  [[package]]
480
480
  name = "icu_locale_fallback"
481
- version = "2.3.0"
481
+ version = "2.4.0"
482
482
  source = "registry+https://github.com/rust-lang/crates.io-index"
483
- checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9"
483
+ checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c"
484
484
  dependencies = [
485
485
  "icu_locale_core",
486
486
  "icu_locale_fallback_data",
@@ -492,15 +492,15 @@ dependencies = [
492
492
 
493
493
  [[package]]
494
494
  name = "icu_locale_fallback_data"
495
- version = "2.3.0"
495
+ version = "2.4.0"
496
496
  source = "registry+https://github.com/rust-lang/crates.io-index"
497
- checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8"
497
+ checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c"
498
498
 
499
499
  [[package]]
500
500
  name = "icu_provider"
501
- version = "2.3.1"
501
+ version = "2.4.0"
502
502
  source = "registry+https://github.com/rust-lang/crates.io-index"
503
- checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"
503
+ checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514"
504
504
  dependencies = [
505
505
  "displaydoc",
506
506
  "icu_locale_core",
@@ -515,9 +515,9 @@ dependencies = [
515
515
 
516
516
  [[package]]
517
517
  name = "icu_segmenter"
518
- version = "2.3.0"
518
+ version = "2.4.0"
519
519
  source = "registry+https://github.com/rust-lang/crates.io-index"
520
- checksum = "82d07aafccd67af15d02512a6adf5896fbc5ed00f2e99b471d2efa14016db3db"
520
+ checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710"
521
521
  dependencies = [
522
522
  "icu_collections",
523
523
  "icu_locale_fallback",
@@ -526,14 +526,15 @@ dependencies = [
526
526
  "potential_utf",
527
527
  "smallvec",
528
528
  "utf8_iter",
529
+ "zerotrie",
529
530
  "zerovec",
530
531
  ]
531
532
 
532
533
  [[package]]
533
534
  name = "icu_segmenter_data"
534
- version = "2.3.0"
535
+ version = "2.4.0"
535
536
  source = "registry+https://github.com/rust-lang/crates.io-index"
536
- checksum = "ae293c039020f9ec10710af98d29ce6aa2051486638b49c9a6409f3b4a9e98ad"
537
+ checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3"
537
538
 
538
539
  [[package]]
539
540
  name = "indexmap"
@@ -599,9 +600,9 @@ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
599
600
 
600
601
  [[package]]
601
602
  name = "libc"
602
- version = "0.2.190"
603
+ version = "0.2.191"
603
604
  source = "registry+https://github.com/rust-lang/crates.io-index"
604
- checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
605
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
605
606
 
606
607
  [[package]]
607
608
  name = "lightningcss"
@@ -722,7 +723,7 @@ dependencies = [
722
723
 
723
724
  [[package]]
724
725
  name = "mkdocs-minify-html-plugin"
725
- version = "0.3.14"
726
+ version = "0.3.17"
726
727
  dependencies = [
727
728
  "minify-html",
728
729
  "pyo3",
@@ -1740,9 +1741,9 @@ dependencies = [
1740
1741
 
1741
1742
  [[package]]
1742
1743
  name = "tinystr"
1743
- version = "0.8.4"
1744
+ version = "0.8.5"
1744
1745
  source = "registry+https://github.com/rust-lang/crates.io-index"
1745
- checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
1746
+ checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a"
1746
1747
  dependencies = [
1747
1748
  "displaydoc",
1748
1749
  "serde_core",
@@ -1902,9 +1903,9 @@ dependencies = [
1902
1903
 
1903
1904
  [[package]]
1904
1905
  name = "yoke"
1905
- version = "0.8.3"
1906
+ version = "0.8.4"
1906
1907
  source = "registry+https://github.com/rust-lang/crates.io-index"
1907
- checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
1908
+ checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3"
1908
1909
  dependencies = [
1909
1910
  "stable_deref_trait",
1910
1911
  "yoke-derive",
@@ -1971,14 +1972,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1971
1972
  checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
1972
1973
  dependencies = [
1973
1974
  "displaydoc",
1975
+ "yoke",
1976
+ "zerofrom",
1974
1977
  "zerovec",
1975
1978
  ]
1976
1979
 
1977
1980
  [[package]]
1978
1981
  name = "zerovec"
1979
- version = "0.11.8"
1982
+ version = "0.11.9"
1980
1983
  source = "registry+https://github.com/rust-lang/crates.io-index"
1981
- checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
1984
+ checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40"
1982
1985
  dependencies = [
1983
1986
  "serde",
1984
1987
  "yoke",
@@ -1988,9 +1991,9 @@ dependencies = [
1988
1991
 
1989
1992
  [[package]]
1990
1993
  name = "zerovec-derive"
1991
- version = "0.11.6"
1994
+ version = "0.11.7"
1992
1995
  source = "registry+https://github.com/rust-lang/crates.io-index"
1993
- checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
1996
+ checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a"
1994
1997
  dependencies = [
1995
1998
  "proc-macro2",
1996
1999
  "quote",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "mkdocs-minify-html-plugin"
3
- version = "0.3.14"
3
+ version = "0.3.17"
4
4
  edition = "2024"
5
5
  license = "MIT"
6
6
  include = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-minify-html-plugin
3
- Version: 0.3.14
3
+ Version: 0.3.17
4
4
  Classifier: Framework :: MkDocs
5
5
  Classifier: Natural Language :: English
6
6
  Classifier: Operating System :: MacOS
@@ -27,17 +27,19 @@ Requires-Python: >=3.11
27
27
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
28
28
  Project-URL: repository, https://github.com/monosans/mkdocs-minify-html-plugin
29
29
 
30
- # mkdocs-minify-html-plugin
30
+ # <img src="https://raw.githubusercontent.com/monosans/mkdocs-minify-html-plugin/main/assets/logo.svg" alt="" width="40" align="top"> mkdocs-minify-html-plugin
31
31
 
32
32
  [![Downloads](https://static.pepy.tech/badge/mkdocs-minify-html-plugin)](https://pepy.tech/project/mkdocs-minify-html-plugin)
33
33
 
34
- MkDocs plugin for minification using [minify-html](https://github.com/wilsonzlin/minify-html), an extremely fast and smart HTML + JS + CSS minifier.
34
+ MkDocs plugin that minifies the built HTML pages, including inline CSS and JS, with [minify-html](https://github.com/wilsonzlin/minify-html).
35
35
 
36
36
  ## Usage
37
37
 
38
38
  Install:
39
39
 
40
40
  ```bash
41
+ uv add --dev mkdocs-minify-html-plugin
42
+ # or
41
43
  pip install -U mkdocs-minify-html-plugin
42
44
  ```
43
45
 
@@ -51,9 +53,7 @@ plugins:
51
53
 
52
54
  ## Options
53
55
 
54
- A description of all options is available in the [minify_html docs](https://docs.rs/minify-html/0.16.4/minify_html/struct.Cfg.html#fields).
55
-
56
- The default plugin options are aimed at the best possible minification while maintaining compliance with the specification:
56
+ The options are the fields of minify-html's [`Cfg`](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html#fields). The defaults aim for the smallest output that stays spec-compliant:
57
57
 
58
58
  ```yaml
59
59
  plugins:
@@ -1,14 +1,16 @@
1
- # mkdocs-minify-html-plugin
1
+ # <img src="https://raw.githubusercontent.com/monosans/mkdocs-minify-html-plugin/main/assets/logo.svg" alt="" width="40" align="top"> mkdocs-minify-html-plugin
2
2
 
3
3
  [![Downloads](https://static.pepy.tech/badge/mkdocs-minify-html-plugin)](https://pepy.tech/project/mkdocs-minify-html-plugin)
4
4
 
5
- MkDocs plugin for minification using [minify-html](https://github.com/wilsonzlin/minify-html), an extremely fast and smart HTML + JS + CSS minifier.
5
+ MkDocs plugin that minifies the built HTML pages, including inline CSS and JS, with [minify-html](https://github.com/wilsonzlin/minify-html).
6
6
 
7
7
  ## Usage
8
8
 
9
9
  Install:
10
10
 
11
11
  ```bash
12
+ uv add --dev mkdocs-minify-html-plugin
13
+ # or
12
14
  pip install -U mkdocs-minify-html-plugin
13
15
  ```
14
16
 
@@ -22,9 +24,7 @@ plugins:
22
24
 
23
25
  ## Options
24
26
 
25
- A description of all options is available in the [minify_html docs](https://docs.rs/minify-html/0.16.4/minify_html/struct.Cfg.html#fields).
26
-
27
- The default plugin options are aimed at the best possible minification while maintaining compliance with the specification:
27
+ The options are the fields of minify-html's [`Cfg`](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html#fields). The defaults aim for the smallest output that stays spec-compliant:
28
28
 
29
29
  ```yaml
30
30
  plugins:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mkdocs-minify-html-plugin"
3
- version = "0.3.14"
3
+ version = "0.3.17"
4
4
  description = "MkDocs plugin for minification using minify-html, an extremely fast and smart HTML + JS + CSS minifier"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -28,7 +28,7 @@ entry-points."mkdocs.plugins".minify_html = "mkdocs_minify_html_plugin.plugin:Mi
28
28
  dependencies = ["mkdocs>=1.4,<2", "typing-extensions>=4.4; python_version<'3.12'"]
29
29
 
30
30
  [dependency-groups]
31
- dev = ["mypy==2.4.0", "ruff==0.17.0"]
31
+ dev = ["mypy==2.4.0", "ruff==0.17.1"]
32
32
 
33
33
  [build-system]
34
34
  requires = ["maturin>=1,<2"]
@@ -0,0 +1,24 @@
1
+ from typing import final
2
+
3
+ @final
4
+ class Minifier:
5
+ def __init__(
6
+ self,
7
+ *,
8
+ allow_noncompliant_unquoted_attribute_values: bool,
9
+ allow_optimal_entities: bool,
10
+ allow_removing_spaces_between_attributes: bool,
11
+ keep_closing_tags: bool,
12
+ keep_comments: bool,
13
+ keep_html_and_head_opening_tags: bool,
14
+ keep_input_type_text_attr: bool,
15
+ keep_ssi_comments: bool,
16
+ minify_css: bool,
17
+ minify_doctype: bool,
18
+ minify_js: bool,
19
+ preserve_brace_template_syntax: bool,
20
+ preserve_chevron_percent_template_syntax: bool,
21
+ remove_bangs: bool,
22
+ remove_processing_instructions: bool,
23
+ ) -> None: ...
24
+ def minify(self, code: str, /) -> str: ...
@@ -8,7 +8,7 @@ from mkdocs.config.defaults import MkDocsConfig
8
8
  from mkdocs.plugins import BasePlugin
9
9
  from mkdocs.structure.pages import Page
10
10
 
11
- from mkdocs_minify_html_plugin._minify_html import minify
11
+ from mkdocs_minify_html_plugin._minify_html import Minifier
12
12
 
13
13
  if sys.version_info >= (3, 12):
14
14
  from typing import override
@@ -35,16 +35,23 @@ class MinifyHtmlConfig(Config):
35
35
 
36
36
 
37
37
  class MinifyHtmlPlugin(BasePlugin[MinifyHtmlConfig]):
38
+ _minifier: Minifier
39
+
40
+ @override
41
+ def on_config(self, config: MkDocsConfig) -> MkDocsConfig | None:
42
+ self._minifier = Minifier(**self.config)
43
+ return config
44
+
38
45
  @override
39
46
  def on_post_page(
40
47
  self, output: str, *, page: Page, config: MkDocsConfig
41
48
  ) -> str | None:
42
- return minify(output, **self.config)
49
+ return self._minifier.minify(output)
43
50
 
44
51
  @override
45
52
  def on_post_template(
46
53
  self, output_content: str, *, template_name: str, config: MkDocsConfig
47
54
  ) -> str | None:
48
55
  if template_name.endswith(".html"):
49
- return minify(output_content, **self.config)
56
+ return self._minifier.minify(output_content)
50
57
  return output_content
@@ -0,0 +1,130 @@
1
+ #![deny(
2
+ warnings,
3
+ deprecated_safe,
4
+ future_incompatible,
5
+ keyword_idents,
6
+ let_underscore,
7
+ nonstandard_style,
8
+ refining_impl_trait,
9
+ rust_2018_compatibility,
10
+ rust_2018_idioms,
11
+ rust_2021_compatibility,
12
+ rust_2024_compatibility,
13
+ unused,
14
+ clippy::all,
15
+ clippy::pedantic,
16
+ clippy::restriction,
17
+ clippy::nursery,
18
+ clippy::cargo
19
+ )]
20
+ #![allow(
21
+ clippy::absolute_paths,
22
+ clippy::allow_attributes_without_reason,
23
+ clippy::arbitrary_source_item_ordering,
24
+ clippy::as_conversions,
25
+ clippy::blanket_clippy_restriction_lints,
26
+ clippy::cast_precision_loss,
27
+ clippy::cognitive_complexity,
28
+ clippy::else_if_without_else,
29
+ clippy::float_arithmetic,
30
+ clippy::implicit_return,
31
+ clippy::integer_division_remainder_used,
32
+ clippy::iter_over_hash_type,
33
+ clippy::min_ident_chars,
34
+ clippy::missing_docs_in_private_items,
35
+ clippy::mod_module_files,
36
+ clippy::multiple_crate_versions,
37
+ clippy::pattern_type_mismatch,
38
+ clippy::question_mark_used,
39
+ clippy::separated_literal_suffix,
40
+ clippy::shadow_reuse,
41
+ clippy::shadow_unrelated,
42
+ clippy::single_call_fn,
43
+ clippy::single_char_lifetime_names,
44
+ clippy::std_instead_of_alloc,
45
+ clippy::std_instead_of_core,
46
+ clippy::too_many_lines,
47
+ clippy::unwrap_used
48
+ )]
49
+
50
+ use pyo3::prelude::*;
51
+
52
+ #[pymodule]
53
+ mod _minify_html {
54
+ use pyo3::prelude::*;
55
+
56
+ /// Minifies HTML with options set once, so that each page only passes
57
+ /// its code.
58
+ #[pyclass(frozen, module = "mkdocs_minify_html_plugin._minify_html")]
59
+ struct Minifier(::minify_html::Cfg);
60
+
61
+ #[pymethods]
62
+ impl Minifier {
63
+ #[new]
64
+ #[pyo3(signature = (
65
+ *,
66
+ allow_noncompliant_unquoted_attribute_values,
67
+ allow_optimal_entities,
68
+ allow_removing_spaces_between_attributes,
69
+ keep_closing_tags,
70
+ keep_comments,
71
+ keep_html_and_head_opening_tags,
72
+ keep_input_type_text_attr,
73
+ keep_ssi_comments,
74
+ minify_css,
75
+ minify_doctype,
76
+ minify_js,
77
+ preserve_brace_template_syntax,
78
+ preserve_chevron_percent_template_syntax,
79
+ remove_bangs,
80
+ remove_processing_instructions,
81
+ ))]
82
+ #[expect(clippy::fn_params_excessive_bools, clippy::too_many_arguments)]
83
+ const fn new(
84
+ allow_noncompliant_unquoted_attribute_values: bool,
85
+ allow_optimal_entities: bool,
86
+ allow_removing_spaces_between_attributes: bool,
87
+ keep_closing_tags: bool,
88
+ keep_comments: bool,
89
+ keep_html_and_head_opening_tags: bool,
90
+ keep_input_type_text_attr: bool,
91
+ keep_ssi_comments: bool,
92
+ minify_css: bool,
93
+ minify_doctype: bool,
94
+ minify_js: bool,
95
+ preserve_brace_template_syntax: bool,
96
+ preserve_chevron_percent_template_syntax: bool,
97
+ remove_bangs: bool,
98
+ remove_processing_instructions: bool,
99
+ ) -> Self {
100
+ Self(::minify_html::Cfg {
101
+ allow_noncompliant_unquoted_attribute_values,
102
+ allow_optimal_entities,
103
+ allow_removing_spaces_between_attributes,
104
+ keep_closing_tags,
105
+ keep_comments,
106
+ keep_html_and_head_opening_tags,
107
+ keep_input_type_text_attr,
108
+ keep_ssi_comments,
109
+ minify_css,
110
+ minify_doctype,
111
+ minify_js,
112
+ preserve_brace_template_syntax,
113
+ preserve_chevron_percent_template_syntax,
114
+ remove_bangs,
115
+ remove_processing_instructions,
116
+ })
117
+ }
118
+
119
+ #[pyo3(signature = (code, /))]
120
+ fn minify<'py>(
121
+ &self,
122
+ py: Python<'py>,
123
+ code: &str,
124
+ ) -> PyResult<Bound<'py, pyo3::types::PyString>> {
125
+ let minified =
126
+ py.detach(|| ::minify_html::minify(code.as_bytes(), &self.0));
127
+ pyo3::types::PyString::from_bytes(py, &minified)
128
+ }
129
+ }
130
+ }
@@ -1,20 +0,0 @@
1
- def minify(
2
- code: str,
3
- /,
4
- *,
5
- allow_noncompliant_unquoted_attribute_values: bool,
6
- allow_optimal_entities: bool,
7
- allow_removing_spaces_between_attributes: bool,
8
- keep_closing_tags: bool,
9
- keep_comments: bool,
10
- keep_html_and_head_opening_tags: bool,
11
- keep_input_type_text_attr: bool,
12
- keep_ssi_comments: bool,
13
- minify_css: bool,
14
- minify_doctype: bool,
15
- minify_js: bool,
16
- preserve_brace_template_syntax: bool,
17
- preserve_chevron_percent_template_syntax: bool,
18
- remove_bangs: bool,
19
- remove_processing_instructions: bool,
20
- ) -> str: ...
@@ -1,119 +0,0 @@
1
- #![deny(
2
- warnings,
3
- deprecated_safe,
4
- future_incompatible,
5
- keyword_idents,
6
- let_underscore,
7
- nonstandard_style,
8
- refining_impl_trait,
9
- rust_2018_compatibility,
10
- rust_2018_idioms,
11
- rust_2021_compatibility,
12
- rust_2024_compatibility,
13
- unused,
14
- clippy::all,
15
- clippy::pedantic,
16
- clippy::restriction,
17
- clippy::nursery,
18
- clippy::cargo
19
- )]
20
- #![allow(
21
- clippy::absolute_paths,
22
- clippy::allow_attributes_without_reason,
23
- clippy::arbitrary_source_item_ordering,
24
- clippy::as_conversions,
25
- clippy::blanket_clippy_restriction_lints,
26
- clippy::cast_precision_loss,
27
- clippy::cognitive_complexity,
28
- clippy::else_if_without_else,
29
- clippy::float_arithmetic,
30
- clippy::implicit_return,
31
- clippy::integer_division_remainder_used,
32
- clippy::iter_over_hash_type,
33
- clippy::min_ident_chars,
34
- clippy::missing_docs_in_private_items,
35
- clippy::mod_module_files,
36
- clippy::multiple_crate_versions,
37
- clippy::pattern_type_mismatch,
38
- clippy::question_mark_used,
39
- clippy::separated_literal_suffix,
40
- clippy::shadow_reuse,
41
- clippy::shadow_unrelated,
42
- clippy::single_call_fn,
43
- clippy::single_char_lifetime_names,
44
- clippy::std_instead_of_alloc,
45
- clippy::std_instead_of_core,
46
- clippy::too_many_lines,
47
- clippy::unwrap_used
48
- )]
49
-
50
- use pyo3::prelude::*;
51
-
52
- #[pymodule]
53
- mod _minify_html {
54
- use pyo3::prelude::*;
55
-
56
- #[pyfunction]
57
- #[pyo3(signature = (
58
- code,
59
- /,
60
- *,
61
- allow_noncompliant_unquoted_attribute_values,
62
- allow_optimal_entities,
63
- allow_removing_spaces_between_attributes,
64
- keep_closing_tags,
65
- keep_comments,
66
- keep_html_and_head_opening_tags,
67
- keep_input_type_text_attr,
68
- keep_ssi_comments,
69
- minify_css,
70
- minify_doctype,
71
- minify_js,
72
- preserve_brace_template_syntax,
73
- preserve_chevron_percent_template_syntax,
74
- remove_bangs,
75
- remove_processing_instructions,
76
- ))]
77
- #[expect(clippy::fn_params_excessive_bools, clippy::too_many_arguments)]
78
- fn minify<'py>(
79
- py: Python<'py>,
80
- code: &str,
81
- allow_noncompliant_unquoted_attribute_values: bool,
82
- allow_optimal_entities: bool,
83
- allow_removing_spaces_between_attributes: bool,
84
- keep_closing_tags: bool,
85
- keep_comments: bool,
86
- keep_html_and_head_opening_tags: bool,
87
- keep_input_type_text_attr: bool,
88
- keep_ssi_comments: bool,
89
- minify_css: bool,
90
- minify_doctype: bool,
91
- minify_js: bool,
92
- preserve_brace_template_syntax: bool,
93
- preserve_chevron_percent_template_syntax: bool,
94
- remove_bangs: bool,
95
- remove_processing_instructions: bool,
96
- ) -> PyResult<Bound<'py, pyo3::types::PyString>> {
97
- let minified = py.detach(move || {
98
- let cfg = ::minify_html::Cfg {
99
- allow_noncompliant_unquoted_attribute_values,
100
- allow_optimal_entities,
101
- allow_removing_spaces_between_attributes,
102
- keep_closing_tags,
103
- keep_comments,
104
- keep_html_and_head_opening_tags,
105
- keep_input_type_text_attr,
106
- keep_ssi_comments,
107
- minify_css,
108
- minify_doctype,
109
- minify_js,
110
- preserve_brace_template_syntax,
111
- preserve_chevron_percent_template_syntax,
112
- remove_bangs,
113
- remove_processing_instructions,
114
- };
115
- ::minify_html::minify(code.as_bytes(), &cfg)
116
- });
117
- pyo3::types::PyString::from_bytes(py, &minified)
118
- }
119
- }