diff --git a/docs/about/release-notes.md b/docs/about/release-notes.md index 211ffd76..207a9263 100644 --- a/docs/about/release-notes.md +++ b/docs/about/release-notes.md @@ -54,6 +54,10 @@ your global navigation uses more than one level, things will likely be broken. [Bootswatch 4.1]: https://getbootstrap.com/docs/4.1/getting-started/introduction/ [dropdowns]: https://getbootstrap.com/docs/4.1/components/navs/#pills-with-dropdowns +### Other Changes and Additions to Version 1.1 + +* Bugfix: Do not normalize URL fragments (#1655). + ## Version 1.0.4 (2018-09-07) * Bugfix: Ignore absolute links in Markdown (#1621). diff --git a/mkdocs/tests/utils/utils_tests.py b/mkdocs/tests/utils/utils_tests.py index 76be3238..00e9adae 100644 --- a/mkdocs/tests/utils/utils_tests.py +++ b/mkdocs/tests/utils/utils_tests.py @@ -104,6 +104,11 @@ class UtilsTests(unittest.TestCase): 'style.css?v=20180308c', 'style.css?v=20180308c', '../style.css?v=20180308c' + ], + '#some_id': [ + '#some_id', + '#some_id', + '#some_id' ] } @@ -160,6 +165,11 @@ class UtilsTests(unittest.TestCase): 'style.css?v=20180308c', '../style.css?v=20180308c', '../../style.css?v=20180308c' + ], + '#some_id': [ + '#some_id', + '#some_id', + '#some_id' ] } diff --git a/mkdocs/utils/__init__.py b/mkdocs/utils/__init__.py index 8c91447f..c728cb79 100644 --- a/mkdocs/utils/__init__.py +++ b/mkdocs/utils/__init__.py @@ -243,7 +243,7 @@ def normalize_url(path, page=None, base=''): path = path_to_url(path or '.') # Allow links to be fully qualified URL's parsed = urlparse(path) - if parsed.scheme or parsed.netloc or path.startswith('/'): + if parsed.scheme or parsed.netloc or path.startswith(('/', '#')): return path # We must be looking at a local path.