mkdocs / mkdocs-redirects

Open source plugin for Mkdocs page redirects
MIT License
176 stars 25 forks source link

Add support for hash fragment redirect targets #42

Closed wwarriner closed 2 years ago

wwarriner commented 2 years ago

Adds support for hash fragment redirect targets.

This will allow e.g. old.md: new.md#section to work as expected.

I added a helper function to split the hash fragment off the rest of the path. Whenever the hash fragment gets in the way of path manipulation logic, it gets detached and/or reattached, as appropriate.

To validate I added duplicate test cases with hash fragments, though there are no tests for on_post_build(). I verified that with a mkdocs project, but can't readily share that verification.

Fixes #16

wwarriner commented 2 years ago

I think this is done. I am unsure how to address the concern over silent drop of the second return value from the helper function on line 133 on plugin.py. In my experience this hasn't caused any issues, but I defer to your expertise.

oprypin commented 2 years ago

Thanks

oprypin commented 2 years ago

:heavy_check_mark: :shipit: https://github.com/mkdocs/mkdocs-redirects/releases/tag/1.1.0