* Add in-place replacement option for linkchecker.py
Add a new flag '-w' to enable an experimental in-place replacement for Markdown
links only.
* Apply suggestions from code review
Use formatted string literals instead of simple concatenation.
Co-authored-by: Matt Boersma <Matt.Boersma@microsoft.com>
* Remove other paths that should not be changed.
* Add more logic to remove paths that start with http or paths that are already linking to the localized page (i.e. start with '/<language-code>').
* Apply suggestions from code review
Simplify expressions.
Co-authored-by: Matt Boersma <Matt.Boersma@microsoft.com>
* Avoid updating pages in English.
* Fix syntax error in set comprehension
* Expand on documentation for new -w flag
* Update documentation for linkchecker.py in README
* Add a blurb with information about the new -w
switch that describes what it does and what is
the purpose of adding this behaviour change.
* Update the previously existing description to
match the currently available script flags.
---------
Co-authored-by: Matt Boersma <Matt.Boersma@microsoft.com>
When an absolute link is missing the leading slash (it starts with
"docs/foo" instead of "/docs/foo/"), print a more specific error instead
of the generic catch-all warning.
Without the leading slash, these are treated as relative paths and so
lead to non-existing pages.
Also, while we're at it, fix the instance it detects.
The linkchecker script is not working the same way as the `scripts/lsync.sh`.
- The path must start with '/docs'. This is not implied in any way.
- The language can be deduced if user provides a full path to a markdown
file, e.g. `content/en/docs/concepts/security/controlling-access.md`.
- The path parameter could use a positional argument for ease of use.
This PR improves the user experience for the tool.