mkdocs-htmlproofer-plugin 1.1.0__tar.gz → 1.2.0__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.
- {mkdocs-htmlproofer-plugin-1.1.0/mkdocs_htmlproofer_plugin.egg-info → mkdocs-htmlproofer-plugin-1.2.0}/PKG-INFO +12 -1
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/README.md +11 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/htmlproofer/plugin.py +10 -10
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0/mkdocs_htmlproofer_plugin.egg-info}/PKG-INFO +12 -1
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/setup.py +1 -1
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/LICENSE.md +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/htmlproofer/__init__.py +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/mkdocs_htmlproofer_plugin.egg-info/SOURCES.txt +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/mkdocs_htmlproofer_plugin.egg-info/dependency_links.txt +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/mkdocs_htmlproofer_plugin.egg-info/entry_points.txt +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/mkdocs_htmlproofer_plugin.egg-info/requires.txt +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/mkdocs_htmlproofer_plugin.egg-info/top_level.txt +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/pyproject.toml +0 -0
- {mkdocs-htmlproofer-plugin-1.1.0 → mkdocs-htmlproofer-plugin-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mkdocs-htmlproofer-plugin
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A MkDocs plugin that validates URL in rendered HTML files
|
|
5
5
|
Home-page: https://github.com/manuzhang/mkdocs-htmlproofer-plugin
|
|
6
6
|
Author: Manu Zhang
|
|
@@ -162,6 +162,17 @@ plugins:
|
|
|
162
162
|
validate_rendered_template: True
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
### `skip_downloads`
|
|
166
|
+
|
|
167
|
+
Optionally skip downloading of a remote URLs content via GET request. This can
|
|
168
|
+
considerably reduce the time taken to validate URLs.
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
plugins:
|
|
172
|
+
- htmlproofer:
|
|
173
|
+
skip_downloads: True
|
|
174
|
+
```
|
|
175
|
+
|
|
165
176
|
## Compatibility with `attr_list` extension
|
|
166
177
|
|
|
167
178
|
If you need to manually specify anchors make use of the `attr_list` [extension](https://python-markdown.github.io/extensions/attr_list) in the markdown.
|
|
@@ -139,6 +139,17 @@ plugins:
|
|
|
139
139
|
validate_rendered_template: True
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
+
### `skip_downloads`
|
|
143
|
+
|
|
144
|
+
Optionally skip downloading of a remote URLs content via GET request. This can
|
|
145
|
+
considerably reduce the time taken to validate URLs.
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
plugins:
|
|
149
|
+
- htmlproofer:
|
|
150
|
+
skip_downloads: True
|
|
151
|
+
```
|
|
152
|
+
|
|
142
153
|
## Compatibility with `attr_list` extension
|
|
143
154
|
|
|
144
155
|
If you need to manually specify anchors make use of the `attr_list` [extension](https://python-markdown.github.io/extensions/attr_list) in the markdown.
|
|
@@ -65,6 +65,7 @@ class HtmlProoferPlugin(BasePlugin):
|
|
|
65
65
|
('raise_error', config_options.Type(bool, default=False)),
|
|
66
66
|
('raise_error_after_finish', config_options.Type(bool, default=False)),
|
|
67
67
|
('raise_error_excludes', config_options.Type(dict, default={})),
|
|
68
|
+
('skip_downloads', config_options.Type(bool, default=False)),
|
|
68
69
|
('validate_external_urls', config_options.Type(bool, default=True)),
|
|
69
70
|
('validate_rendered_template', config_options.Type(bool, default=False)),
|
|
70
71
|
('ignore_urls', config_options.Type(list, default=[])),
|
|
@@ -146,7 +147,13 @@ class HtmlProoferPlugin(BasePlugin):
|
|
|
146
147
|
@lru_cache(maxsize=1000)
|
|
147
148
|
def resolve_web_scheme(self, url: str) -> int:
|
|
148
149
|
try:
|
|
149
|
-
response = self._session.get(url, timeout=URL_TIMEOUT)
|
|
150
|
+
response = self._session.get(url, timeout=URL_TIMEOUT, stream=True)
|
|
151
|
+
|
|
152
|
+
if self.config['skip_downloads'] is False:
|
|
153
|
+
# Download the entire contents as to not break previous behaviour.
|
|
154
|
+
for _ in response.iter_content(chunk_size=1024):
|
|
155
|
+
pass
|
|
156
|
+
|
|
150
157
|
return response.status_code
|
|
151
158
|
except requests.exceptions.Timeout:
|
|
152
159
|
return 504
|
|
@@ -285,17 +292,10 @@ class HtmlProoferPlugin(BasePlugin):
|
|
|
285
292
|
def bad_url(url_status: int) -> bool:
|
|
286
293
|
if url_status == -1:
|
|
287
294
|
return True
|
|
288
|
-
elif url_status == 401 or url_status == 403:
|
|
289
|
-
return False
|
|
290
|
-
elif url_status in (503, 504):
|
|
291
|
-
# Usually transient
|
|
292
|
-
return False
|
|
293
|
-
elif url_status == 999:
|
|
294
|
-
# Returned by some websites (e.g. LinkedIn) that think you're crawling them.
|
|
295
|
-
return False
|
|
296
295
|
elif url_status >= 400:
|
|
297
296
|
return True
|
|
298
|
-
|
|
297
|
+
else:
|
|
298
|
+
return False
|
|
299
299
|
|
|
300
300
|
@staticmethod
|
|
301
301
|
def is_error(config: Config, url: str, url_status: int) -> bool:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mkdocs-htmlproofer-plugin
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A MkDocs plugin that validates URL in rendered HTML files
|
|
5
5
|
Home-page: https://github.com/manuzhang/mkdocs-htmlproofer-plugin
|
|
6
6
|
Author: Manu Zhang
|
|
@@ -162,6 +162,17 @@ plugins:
|
|
|
162
162
|
validate_rendered_template: True
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
### `skip_downloads`
|
|
166
|
+
|
|
167
|
+
Optionally skip downloading of a remote URLs content via GET request. This can
|
|
168
|
+
considerably reduce the time taken to validate URLs.
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
plugins:
|
|
172
|
+
- htmlproofer:
|
|
173
|
+
skip_downloads: True
|
|
174
|
+
```
|
|
175
|
+
|
|
165
176
|
## Compatibility with `attr_list` extension
|
|
166
177
|
|
|
167
178
|
If you need to manually specify anchors make use of the `attr_list` [extension](https://python-markdown.github.io/extensions/attr_list) in the markdown.
|
|
@@ -9,7 +9,7 @@ def read(fname: str):
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name='mkdocs-htmlproofer-plugin',
|
|
12
|
-
version='1.
|
|
12
|
+
version='1.2.0',
|
|
13
13
|
description='A MkDocs plugin that validates URL in rendered HTML files',
|
|
14
14
|
long_description=read('README.md'),
|
|
15
15
|
long_description_content_type='text/markdown',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|