diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2020-05-07 21:19:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-07 21:19:46 -0400 |
commit | a6052658fbad43b7636f97685cace2adc736b7fa (patch) | |
tree | f64ad3778973566e5c20f7dbe840c263863f80c1 | |
parent | 375db8ce0764864db6c7f76268592bc726ace33c (diff) | |
download | python-markdown-a6052658fbad43b7636f97685cace2adc736b7fa.tar.gz |
Add checklinks tox env and shell script. (#955)
Also clean up dead links.
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | checklinks.sh | 31 | ||||
-rw-r--r-- | docs/authors.md | 2 | ||||
-rw-r--r-- | docs/change_log/index.md | 3 | ||||
-rw-r--r-- | docs/change_log/release-2.2.md | 2 | ||||
-rw-r--r-- | docs/change_log/release-2.3.md | 2 | ||||
-rw-r--r-- | docs/contributing.md | 5 | ||||
-rw-r--r-- | docs/extensions/admonition.md | 2 | ||||
-rw-r--r-- | docs/extensions/attr_list.md | 4 | ||||
-rw-r--r-- | docs/test_tools.md | 2 | ||||
-rw-r--r-- | tox.ini | 7 |
11 files changed, 51 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml index 28b8a5d..6eec973 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,8 @@ matrix: - aspell - aspell-en - env: TOXENV=pep517check + - env: TOXENV=checklinks + before_install: npm install -g markdown-link-check addons: apt: diff --git a/checklinks.sh b/checklinks.sh new file mode 100755 index 0000000..dd9262b --- /dev/null +++ b/checklinks.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +echo "Checking links in documentation..." + +# List of files in docs dir +docs=$(find . -path './docs/*.md') +# List of files in project root (README, etc) +extras=$(find . -maxdepth 1 -name '*.md') +# Combined list of files to check +files=("${docs[@]}" "${extras[@]}") + +let "fails=0" +let "count=0" + +for file in ${files[@]}; do + let "count++" + markdown-link-check -q "$file" + if [ $? -ne 0 ]; then + let "fails++" + fi +done + +echo -e "\n\033[0;33m$count files checked." + +if [ $fails -gt 0 ]; then + echo -e "\033[0;31mERROR: $fails files with dead links found!" + exit 1 +else + echo -e "\033[0;32mCongratulations! No dead links found." + exit 0 +fi diff --git a/docs/authors.md b/docs/authors.md index ba674c3..6b164fd 100644 --- a/docs/authors.md +++ b/docs/authors.md @@ -28,7 +28,7 @@ Primary Authors Ph.D. Various pieces of his code still exist, most notably the basic structure. -* __[Manfed Stienstra](http://www.dwerg.net/)__ +* __Manfed Stienstra__ Manfed wrote the original version of the script and is responsible for various parts of the existing code base. diff --git a/docs/change_log/index.md b/docs/change_log/index.md index c070295..8975de6 100644 --- a/docs/change_log/index.md +++ b/docs/change_log/index.md @@ -5,6 +5,7 @@ Python-Markdown Change Log Under development: version 3.2.2 (a bug-fix release). +* Add `checklinks` tox environment to ensure all links in documentation are good. * Refactor extension API documentation (#729). * Load entry_points (for extensions) only once using `importlib.metadata`. * Do not double escape entities in TOC. @@ -262,4 +263,4 @@ escape, emphasis in the beginning of the paragraph. Nov. 2004: Added links, blockquotes, HTML blocks to Manfred Stienstra's code -Apr. 2004: Manfred's version at <http://www.dwerg.net/projects/markdown/> +Apr. 2004: Manfred's version at `http://www.dwerg.net/projects/markdown/` diff --git a/docs/change_log/release-2.2.md b/docs/change_log/release-2.2.md index 379a43e..75f47fa 100644 --- a/docs/change_log/release-2.2.md +++ b/docs/change_log/release-2.2.md @@ -40,7 +40,7 @@ What's New in Python-Markdown 2.2 --------------------------------- The docs were refactored and can now be found at -<http://packages.python.org/Markdown/>. The docs are now maintained in the +`http://packages.python.org/Markdown/`. The docs are now maintained in the Repository and are generated by the `setup.py build_docs` command. The [Sane_Lists](../extensions/sane_lists.md) diff --git a/docs/change_log/release-2.3.md b/docs/change_log/release-2.3.md index fc1809e..f60e426 100644 --- a/docs/change_log/release-2.3.md +++ b/docs/change_log/release-2.3.md @@ -58,7 +58,7 @@ Backwards-incompatible Changes PyTidyLib rather than using an extension (for example: `tidylib.tidy_fragment(markdown.markdown(source), options={...})`). -[PyTidyLib]: http://countergram.com/open-source/pytidylib +[PyTidyLib]: http://countergram.github.io/pytidylib/ What's New in Python-Markdown 2.3 --------------------------------- diff --git a/docs/contributing.md b/docs/contributing.md index ca95042..974d380 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -9,7 +9,7 @@ propose changes to this document in a pull request. This project and everyone participating in it is governed by the [Python-Markdown Code of Conduct]. By participating, you are expected to uphold -this code. Please report unacceptable behavior to <markdown@freewisdom.org>. +this code. Please report unacceptable behavior to [markdown@freewisdom.org][email]. ## Project Organization @@ -473,6 +473,7 @@ label from the same group. [Python-Markdown Organization]: https://github.com/Python-Markdown [Python-Markdown Code of Conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md +[email]: mailto:markdown@freewisdom.org [Python-Markdown/markdown]: https://github.com/Python-Markdown/markdown [issue tracker]: https://github.com/Python-Markdown/markdown/issues [syntax rules]: https://daringfireball.net/projects/markdown/syntax @@ -495,7 +496,7 @@ label from the same group. [configure a remote]: https://help.github.com/articles/configuring-a-remote-for-a-fork [sync changes]: https://help.github.com/articles/syncing-a-fork [virtual environment]: https://virtualenv.pypa.io/en/stable/ -[User Guide]: https://virtualenv.pypa.io/en/stable/userguide/#usage +[User Guide]: https://virtualenv.pypa.io/en/stable/user_guide.html [Development Mode]: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode [PyTidyLib]: https://countergram.github.io/pytidylib/ [HTML Tidy]: https://www.html-tidy.org/ diff --git a/docs/extensions/admonition.md b/docs/extensions/admonition.md index 886320a..24d8254 100644 --- a/docs/extensions/admonition.md +++ b/docs/extensions/admonition.md @@ -99,7 +99,7 @@ Styling There is no CSS included as part of this extension. Check out the default [Sphinx][sphinx] theme for inspiration. -[sphinx]: http://sphinx.pocoo.org/ +[sphinx]: https://www.sphinx-doc.org/en/stable/ ## Usage diff --git a/docs/extensions/attr_list.md b/docs/extensions/attr_list.md index d89eac2..4dcbc59 100644 --- a/docs/extensions/attr_list.md +++ b/docs/extensions/attr_list.md @@ -11,9 +11,9 @@ This extension is included in the standard Markdown library. ## Syntax -The basic syntax was inspired by [Maruku][]'s Attribute Lists feature. +The basic syntax was inspired by Maruku's Attribute Lists feature (see [web archive][Maruku]). -[Maruku]: http://maruku.rubyforge.org/proposal.html#attribute_lists +[Maruku]: https://web.archive.org/web/20170324172643/http://maruku.rubyforge.org/proposal.html ### The List diff --git a/docs/test_tools.md b/docs/test_tools.md index c252086..3a83d8e 100644 --- a/docs/test_tools.md +++ b/docs/test_tools.md @@ -169,6 +169,6 @@ rules apply. [unittest]: https://docs.python.org/3/library/unittest.html [Perl]: https://daringfireball.net/projects/markdown/ [PHP]: http://michelf.com/projects/php-markdown/ -[PyTidyLib]: http://countergram.com/open-source/pytidylib/ +[PyTidyLib]: http://countergram.github.io/pytidylib/ [Contributing Guide]: contributing.md [development environment]: contributing.md#development-environment @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, py37, py38, pypy3, flake8, checkspelling, pep517check +envlist = py35, py36, py37, py38, pypy3, flake8, checkspelling, pep517check, checklinks isolated_build = True min_verison = 1.9 @@ -20,6 +20,11 @@ deps = mkdocs_nature commands = {toxinidir}/checkspelling.sh +[testenv:checklinks] +whitelist_externals = markdown-link-check +deps = +commands = {toxinidir}/checklinks.sh + [testenv:pep517check] deps = pep517 commands = python -m pep517.check {toxinidir} |