We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
link of absolute path without domains will display a warning
If I wrote `[link](/api/file.pdf)` in docs, it would show a warning like this:

```
WARNING -  Documentation file 'forum.md' contains a link to 'api/file.pdf' which is not found in the documentation files.
```

The link works in  the generated docs. The only problem is the warning message.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mkdocs/structure/pages.py`
Content:
```
1 # coding: utf-8
2 
3 from __future__ import unicode_literals
4 
5 import os
6 import io
7 import datetime
8 import logging
9 
10 import markdown
11 from markdown.extensions import Extension
12 from markdown.treeprocessors import Treeprocessor
13 from markdown.util import AMP_SUBSTITUTE
14 
15 from mkdocs.structure.toc import get_toc
16 from mkdocs.utils import meta, urlparse, urlunparse, urljoin, get_markdown_title, warning_filter
17 
18 log = logging.getLogger(__name__)
19 log.addFilter(warning_filter)
20 
21 
22 class Page(object):
23     def __init__(self, title, file, config):
24         file.page = self
25         self.file = file
26         self.title = title
27 
28         # Navigation attributes
29         self.parent = None
30         self.children = None
31         self.previous_page = None
32         self.next_page = None
33         self.active = False
34 
35         self.is_section = False
36         self.is_page = True
37         self.is_link = False
38 
39         # Support SOURCE_DATE_EPOCH environment variable for "reproducible" builds.
40         # See https://reproducible-builds.org/specs/source-date-epoch/
41         if 'SOURCE_DATE_EPOCH' in os.environ:
42             self.update_date = datetime.datetime.utcfromtimestamp(
43                 int(os.environ['SOURCE_DATE_EPOCH'])
44             ).strftime("%Y-%m-%d")
45         else:
46             self.update_date = datetime.datetime.now().strftime("%Y-%m-%d")
47 
48         self._set_canonical_url(config.get('site_url', None))
49         self._set_edit_url(config.get('repo_url', None), config.get('edit_uri', None))
50 
51         # Placeholders to be filled in later in the build process.
52         self.markdown = None
53         self.content = None
54         self.toc = []
55         self.meta = {}
56 
57     def __eq__(self, other):
58 
59         def sub_dict(d):
60             return dict((key, value) for key, value in d.items() if key in ['title', 'file'])
61 
62         return (isinstance(other, self.__class__) and sub_dict(self.__dict__) == sub_dict(other.__dict__))
63 
64     def __ne__(self, other):
65         return not self.__eq__(other)
66 
67     def __repr__(self):
68         title = "'{}'".format(self.title) if (self.title is not None) else '[blank]'
69         return "Page(title={}, url='{}')".format(title, self.abs_url or self.file.url)
70 
71     def _indent_print(self, depth=0):
72         return '{}{}'.format('    ' * depth, repr(self))
73 
74     def _get_active(self):
75         """ Return active status of page. """
76         return self.__active
77 
78     def _set_active(self, value):
79         """ Set active status of page and ancestors. """
80         self.__active = bool(value)
81         if self.parent is not None:
82             self.parent.active = bool(value)
83 
84     active = property(_get_active, _set_active)
85 
86     @property
87     def is_index(self):
88         return self.file.name == 'index'
89 
90     @property
91     def is_top_level(self):
92         return self.parent is None
93 
94     @property
95     def is_homepage(self):
96         return self.is_top_level and self.is_index
97 
98     @property
99     def url(self):
100         return '' if self.file.url == '.' else self.file.url
101 
102     @property
103     def ancestors(self):
104         if self.parent is None:
105             return []
106         return [self.parent] + self.parent.ancestors
107 
108     def _set_canonical_url(self, base):
109         if base:
110             if not base.endswith('/'):
111                 base += '/'
112             self.canonical_url = urljoin(base, self.url)
113             self.abs_url = urlparse(self.canonical_url).path
114         else:
115             self.canonical_url = None
116             self.abs_url = None
117 
118     def _set_edit_url(self, repo_url, edit_uri):
119         if repo_url and edit_uri:
120             src_path = self.file.src_path.replace('\\', '/')
121             self.edit_url = urljoin(repo_url, edit_uri + src_path)
122         else:
123             self.edit_url = None
124 
125     def read_source(self, config):
126         source = config['plugins'].run_event('page_read_source', None, config=config, page=self)
127         if source is None:
128             try:
129                 with io.open(self.file.abs_src_path, 'r', encoding='utf-8-sig', errors='strict') as f:
130                     source = f.read()
131             except IOError:
132                 log.error('File not found: {}'.format(self.file.src_path))
133                 raise
134             except ValueError:
135                 log.error('Encoding error reading file: {}'.format(self.file.src_path))
136                 raise
137 
138         self.markdown, self.meta = meta.get_data(source)
139         self._set_title()
140 
141     def _set_title(self):
142         """
143         Set the title for a Markdown document.
144 
145         Check these in order and use the first that returns a valid title:
146         - value provided on init (passed in from config)
147         - value of metadata 'title'
148         - content of the first H1 in Markdown content
149         - convert filename to title
150         """
151         if self.title is not None:
152             return
153 
154         if 'title' in self.meta:
155             self.title = self.meta['title']
156             return
157 
158         title = get_markdown_title(self.markdown)
159 
160         if title is None:
161             if self.is_homepage:
162                 title = 'Home'
163             else:
164                 title = self.file.name.replace('-', ' ').replace('_', ' ')
165                 # Capitalize if the filename was all lowercase, otherwise leave it as-is.
166                 if title.lower() == title:
167                     title = title.capitalize()
168 
169         self.title = title
170 
171     def render(self, config, files):
172         """
173         Convert the Markdown source file to HTML as per the config.
174         """
175 
176         extensions = [
177             _RelativePathExtension(self.file, files)
178         ] + config['markdown_extensions']
179 
180         md = markdown.Markdown(
181             extensions=extensions,
182             extension_configs=config['mdx_configs'] or {}
183         )
184         self.content = md.convert(self.markdown)
185         self.toc = get_toc(getattr(md, 'toc', ''))
186 
187 
188 class _RelativePathTreeprocessor(Treeprocessor):
189     def __init__(self, file, files):
190         self.file = file
191         self.files = files
192 
193     def run(self, root):
194         """
195         Update urls on anchors and images to make them relative
196 
197         Iterates through the full document tree looking for specific
198         tags and then makes them relative based on the site navigation
199         """
200         for element in root.iter():
201             if element.tag == 'a':
202                 key = 'href'
203             elif element.tag == 'img':
204                 key = 'src'
205             else:
206                 continue
207 
208             url = element.get(key)
209             new_url = self.path_to_url(url)
210             element.set(key, new_url)
211 
212         return root
213 
214     def path_to_url(self, url):
215         scheme, netloc, path, params, query, fragment = urlparse(url)
216 
217         if scheme or netloc or not path or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]:
218             # Ignore URLs unless they are a relative link to a source file.
219             # AMP_SUBSTITUTE is used internally by Markdown only for email.
220             # No '.' in the last part of a path indicates path does not point to a file.
221             return url
222 
223         # Determine the filepath of the target.
224         target_path = os.path.join(os.path.dirname(self.file.src_path), path)
225         target_path = os.path.normpath(target_path).lstrip(os.sep)
226 
227         # Validate that the target exists in files collection.
228         if target_path not in self.files:
229             log.warning(
230                 "Documentation file '{}' contains a link to '{}' which is not found "
231                 "in the documentation files.".format(self.file.src_path, target_path)
232             )
233             return url
234         target_file = self.files.get_file_from_path(target_path)
235         path = target_file.url_relative_to(self.file)
236         components = (scheme, netloc, path, params, query, fragment)
237         return urlunparse(components)
238 
239 
240 class _RelativePathExtension(Extension):
241     """
242     The Extension class is what we pass to markdown, it then
243     registers the Treeprocessor.
244     """
245 
246     def __init__(self, file, files):
247         self.file = file
248         self.files = files
249 
250     def extendMarkdown(self, md, md_globals):
251         relpath = _RelativePathTreeprocessor(self.file, self.files)
252         md.treeprocessors.add("relpath", relpath, "_end")
253
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mkdocs/structure/pages.py b/mkdocs/structure/pages.py
--- a/mkdocs/structure/pages.py
+++ b/mkdocs/structure/pages.py
@@ -214,7 +214,8 @@
     def path_to_url(self, url):
         scheme, netloc, path, params, query, fragment = urlparse(url)
 
-        if scheme or netloc or not path or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]:
+        if (scheme or netloc or not path or url.startswith('/')
+                or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]):
             # Ignore URLs unless they are a relative link to a source file.
             # AMP_SUBSTITUTE is used internally by Markdown only for email.
             # No '.' in the last part of a path indicates path does not point to a file.

{"golden_diff": "diff --git a/mkdocs/structure/pages.py b/mkdocs/structure/pages.py\n--- a/mkdocs/structure/pages.py\n+++ b/mkdocs/structure/pages.py\n@@ -214,7 +214,8 @@\n     def path_to_url(self, url):\n         scheme, netloc, path, params, query, fragment = urlparse(url)\n \n-        if scheme or netloc or not path or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]:\n+        if (scheme or netloc or not path or url.startswith('/')\n+                or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]):\n             # Ignore URLs unless they are a relative link to a source file.\n             # AMP_SUBSTITUTE is used internally by Markdown only for email.\n             # No '.' in the last part of a path indicates path does not point to a file.\n", "issue": "link of absolute path without domains will display a warning\nIf I wrote `[link](/api/file.pdf)` in docs, it would show a warning like this:\r\n\r\n```\r\nWARNING -  Documentation file 'forum.md' contains a link to 'api/file.pdf' which is not found in the documentation files.\r\n```\r\n\r\nThe link works in  the generated docs. The only problem is the warning message.\n", "before_files": [{"content": "# coding: utf-8\n\nfrom __future__ import unicode_literals\n\nimport os\nimport io\nimport datetime\nimport logging\n\nimport markdown\nfrom markdown.extensions import Extension\nfrom markdown.treeprocessors import Treeprocessor\nfrom markdown.util import AMP_SUBSTITUTE\n\nfrom mkdocs.structure.toc import get_toc\nfrom mkdocs.utils import meta, urlparse, urlunparse, urljoin, get_markdown_title, warning_filter\n\nlog = logging.getLogger(__name__)\nlog.addFilter(warning_filter)\n\n\nclass Page(object):\n    def __init__(self, title, file, config):\n        file.page = self\n        self.file = file\n        self.title = title\n\n        # Navigation attributes\n        self.parent = None\n        self.children = None\n        self.previous_page = None\n        self.next_page = None\n        self.active = False\n\n        self.is_section = False\n        self.is_page = True\n        self.is_link = False\n\n        # Support SOURCE_DATE_EPOCH environment variable for \"reproducible\" builds.\n        # See https://reproducible-builds.org/specs/source-date-epoch/\n        if 'SOURCE_DATE_EPOCH' in os.environ:\n            self.update_date = datetime.datetime.utcfromtimestamp(\n                int(os.environ['SOURCE_DATE_EPOCH'])\n            ).strftime(\"%Y-%m-%d\")\n        else:\n            self.update_date = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n\n        self._set_canonical_url(config.get('site_url', None))\n        self._set_edit_url(config.get('repo_url', None), config.get('edit_uri', None))\n\n        # Placeholders to be filled in later in the build process.\n        self.markdown = None\n        self.content = None\n        self.toc = []\n        self.meta = {}\n\n    def __eq__(self, other):\n\n        def sub_dict(d):\n            return dict((key, value) for key, value in d.items() if key in ['title', 'file'])\n\n        return (isinstance(other, self.__class__) and sub_dict(self.__dict__) == sub_dict(other.__dict__))\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __repr__(self):\n        title = \"'{}'\".format(self.title) if (self.title is not None) else '[blank]'\n        return \"Page(title={}, url='{}')\".format(title, self.abs_url or self.file.url)\n\n    def _indent_print(self, depth=0):\n        return '{}{}'.format('    ' * depth, repr(self))\n\n    def _get_active(self):\n        \"\"\" Return active status of page. \"\"\"\n        return self.__active\n\n    def _set_active(self, value):\n        \"\"\" Set active status of page and ancestors. \"\"\"\n        self.__active = bool(value)\n        if self.parent is not None:\n            self.parent.active = bool(value)\n\n    active = property(_get_active, _set_active)\n\n    @property\n    def is_index(self):\n        return self.file.name == 'index'\n\n    @property\n    def is_top_level(self):\n        return self.parent is None\n\n    @property\n    def is_homepage(self):\n        return self.is_top_level and self.is_index\n\n    @property\n    def url(self):\n        return '' if self.file.url == '.' else self.file.url\n\n    @property\n    def ancestors(self):\n        if self.parent is None:\n            return []\n        return [self.parent] + self.parent.ancestors\n\n    def _set_canonical_url(self, base):\n        if base:\n            if not base.endswith('/'):\n                base += '/'\n            self.canonical_url = urljoin(base, self.url)\n            self.abs_url = urlparse(self.canonical_url).path\n        else:\n            self.canonical_url = None\n            self.abs_url = None\n\n    def _set_edit_url(self, repo_url, edit_uri):\n        if repo_url and edit_uri:\n            src_path = self.file.src_path.replace('\\\\', '/')\n            self.edit_url = urljoin(repo_url, edit_uri + src_path)\n        else:\n            self.edit_url = None\n\n    def read_source(self, config):\n        source = config['plugins'].run_event('page_read_source', None, config=config, page=self)\n        if source is None:\n            try:\n                with io.open(self.file.abs_src_path, 'r', encoding='utf-8-sig', errors='strict') as f:\n                    source = f.read()\n            except IOError:\n                log.error('File not found: {}'.format(self.file.src_path))\n                raise\n            except ValueError:\n                log.error('Encoding error reading file: {}'.format(self.file.src_path))\n                raise\n\n        self.markdown, self.meta = meta.get_data(source)\n        self._set_title()\n\n    def _set_title(self):\n        \"\"\"\n        Set the title for a Markdown document.\n\n        Check these in order and use the first that returns a valid title:\n        - value provided on init (passed in from config)\n        - value of metadata 'title'\n        - content of the first H1 in Markdown content\n        - convert filename to title\n        \"\"\"\n        if self.title is not None:\n            return\n\n        if 'title' in self.meta:\n            self.title = self.meta['title']\n            return\n\n        title = get_markdown_title(self.markdown)\n\n        if title is None:\n            if self.is_homepage:\n                title = 'Home'\n            else:\n                title = self.file.name.replace('-', ' ').replace('_', ' ')\n                # Capitalize if the filename was all lowercase, otherwise leave it as-is.\n                if title.lower() == title:\n                    title = title.capitalize()\n\n        self.title = title\n\n    def render(self, config, files):\n        \"\"\"\n        Convert the Markdown source file to HTML as per the config.\n        \"\"\"\n\n        extensions = [\n            _RelativePathExtension(self.file, files)\n        ] + config['markdown_extensions']\n\n        md = markdown.Markdown(\n            extensions=extensions,\n            extension_configs=config['mdx_configs'] or {}\n        )\n        self.content = md.convert(self.markdown)\n        self.toc = get_toc(getattr(md, 'toc', ''))\n\n\nclass _RelativePathTreeprocessor(Treeprocessor):\n    def __init__(self, file, files):\n        self.file = file\n        self.files = files\n\n    def run(self, root):\n        \"\"\"\n        Update urls on anchors and images to make them relative\n\n        Iterates through the full document tree looking for specific\n        tags and then makes them relative based on the site navigation\n        \"\"\"\n        for element in root.iter():\n            if element.tag == 'a':\n                key = 'href'\n            elif element.tag == 'img':\n                key = 'src'\n            else:\n                continue\n\n            url = element.get(key)\n            new_url = self.path_to_url(url)\n            element.set(key, new_url)\n\n        return root\n\n    def path_to_url(self, url):\n        scheme, netloc, path, params, query, fragment = urlparse(url)\n\n        if scheme or netloc or not path or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]:\n            # Ignore URLs unless they are a relative link to a source file.\n            # AMP_SUBSTITUTE is used internally by Markdown only for email.\n            # No '.' in the last part of a path indicates path does not point to a file.\n            return url\n\n        # Determine the filepath of the target.\n        target_path = os.path.join(os.path.dirname(self.file.src_path), path)\n        target_path = os.path.normpath(target_path).lstrip(os.sep)\n\n        # Validate that the target exists in files collection.\n        if target_path not in self.files:\n            log.warning(\n                \"Documentation file '{}' contains a link to '{}' which is not found \"\n                \"in the documentation files.\".format(self.file.src_path, target_path)\n            )\n            return url\n        target_file = self.files.get_file_from_path(target_path)\n        path = target_file.url_relative_to(self.file)\n        components = (scheme, netloc, path, params, query, fragment)\n        return urlunparse(components)\n\n\nclass _RelativePathExtension(Extension):\n    \"\"\"\n    The Extension class is what we pass to markdown, it then\n    registers the Treeprocessor.\n    \"\"\"\n\n    def __init__(self, file, files):\n        self.file = file\n        self.files = files\n\n    def extendMarkdown(self, md, md_globals):\n        relpath = _RelativePathTreeprocessor(self.file, self.files)\n        md.treeprocessors.add(\"relpath\", relpath, \"_end\")\n", "path": "mkdocs/structure/pages.py"}], "after_files": [{"content": "# coding: utf-8\n\nfrom __future__ import unicode_literals\n\nimport os\nimport io\nimport datetime\nimport logging\n\nimport markdown\nfrom markdown.extensions import Extension\nfrom markdown.treeprocessors import Treeprocessor\nfrom markdown.util import AMP_SUBSTITUTE\n\nfrom mkdocs.structure.toc import get_toc\nfrom mkdocs.utils import meta, urlparse, urlunparse, urljoin, get_markdown_title, warning_filter\n\nlog = logging.getLogger(__name__)\nlog.addFilter(warning_filter)\n\n\nclass Page(object):\n    def __init__(self, title, file, config):\n        file.page = self\n        self.file = file\n        self.title = title\n\n        # Navigation attributes\n        self.parent = None\n        self.children = None\n        self.previous_page = None\n        self.next_page = None\n        self.active = False\n\n        self.is_section = False\n        self.is_page = True\n        self.is_link = False\n\n        # Support SOURCE_DATE_EPOCH environment variable for \"reproducible\" builds.\n        # See https://reproducible-builds.org/specs/source-date-epoch/\n        if 'SOURCE_DATE_EPOCH' in os.environ:\n            self.update_date = datetime.datetime.utcfromtimestamp(\n                int(os.environ['SOURCE_DATE_EPOCH'])\n            ).strftime(\"%Y-%m-%d\")\n        else:\n            self.update_date = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n\n        self._set_canonical_url(config.get('site_url', None))\n        self._set_edit_url(config.get('repo_url', None), config.get('edit_uri', None))\n\n        # Placeholders to be filled in later in the build process.\n        self.markdown = None\n        self.content = None\n        self.toc = []\n        self.meta = {}\n\n    def __eq__(self, other):\n\n        def sub_dict(d):\n            return dict((key, value) for key, value in d.items() if key in ['title', 'file'])\n\n        return (isinstance(other, self.__class__) and sub_dict(self.__dict__) == sub_dict(other.__dict__))\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __repr__(self):\n        title = \"'{}'\".format(self.title) if (self.title is not None) else '[blank]'\n        return \"Page(title={}, url='{}')\".format(title, self.abs_url or self.file.url)\n\n    def _indent_print(self, depth=0):\n        return '{}{}'.format('    ' * depth, repr(self))\n\n    def _get_active(self):\n        \"\"\" Return active status of page. \"\"\"\n        return self.__active\n\n    def _set_active(self, value):\n        \"\"\" Set active status of page and ancestors. \"\"\"\n        self.__active = bool(value)\n        if self.parent is not None:\n            self.parent.active = bool(value)\n\n    active = property(_get_active, _set_active)\n\n    @property\n    def is_index(self):\n        return self.file.name == 'index'\n\n    @property\n    def is_top_level(self):\n        return self.parent is None\n\n    @property\n    def is_homepage(self):\n        return self.is_top_level and self.is_index\n\n    @property\n    def url(self):\n        return '' if self.file.url == '.' else self.file.url\n\n    @property\n    def ancestors(self):\n        if self.parent is None:\n            return []\n        return [self.parent] + self.parent.ancestors\n\n    def _set_canonical_url(self, base):\n        if base:\n            if not base.endswith('/'):\n                base += '/'\n            self.canonical_url = urljoin(base, self.url)\n            self.abs_url = urlparse(self.canonical_url).path\n        else:\n            self.canonical_url = None\n            self.abs_url = None\n\n    def _set_edit_url(self, repo_url, edit_uri):\n        if repo_url and edit_uri:\n            src_path = self.file.src_path.replace('\\\\', '/')\n            self.edit_url = urljoin(repo_url, edit_uri + src_path)\n        else:\n            self.edit_url = None\n\n    def read_source(self, config):\n        source = config['plugins'].run_event('page_read_source', None, config=config, page=self)\n        if source is None:\n            try:\n                with io.open(self.file.abs_src_path, 'r', encoding='utf-8-sig', errors='strict') as f:\n                    source = f.read()\n            except IOError:\n                log.error('File not found: {}'.format(self.file.src_path))\n                raise\n            except ValueError:\n                log.error('Encoding error reading file: {}'.format(self.file.src_path))\n                raise\n\n        self.markdown, self.meta = meta.get_data(source)\n        self._set_title()\n\n    def _set_title(self):\n        \"\"\"\n        Set the title for a Markdown document.\n\n        Check these in order and use the first that returns a valid title:\n        - value provided on init (passed in from config)\n        - value of metadata 'title'\n        - content of the first H1 in Markdown content\n        - convert filename to title\n        \"\"\"\n        if self.title is not None:\n            return\n\n        if 'title' in self.meta:\n            self.title = self.meta['title']\n            return\n\n        title = get_markdown_title(self.markdown)\n\n        if title is None:\n            if self.is_homepage:\n                title = 'Home'\n            else:\n                title = self.file.name.replace('-', ' ').replace('_', ' ')\n                # Capitalize if the filename was all lowercase, otherwise leave it as-is.\n                if title.lower() == title:\n                    title = title.capitalize()\n\n        self.title = title\n\n    def render(self, config, files):\n        \"\"\"\n        Convert the Markdown source file to HTML as per the config.\n        \"\"\"\n\n        extensions = [\n            _RelativePathExtension(self.file, files)\n        ] + config['markdown_extensions']\n\n        md = markdown.Markdown(\n            extensions=extensions,\n            extension_configs=config['mdx_configs'] or {}\n        )\n        self.content = md.convert(self.markdown)\n        self.toc = get_toc(getattr(md, 'toc', ''))\n\n\nclass _RelativePathTreeprocessor(Treeprocessor):\n    def __init__(self, file, files):\n        self.file = file\n        self.files = files\n\n    def run(self, root):\n        \"\"\"\n        Update urls on anchors and images to make them relative\n\n        Iterates through the full document tree looking for specific\n        tags and then makes them relative based on the site navigation\n        \"\"\"\n        for element in root.iter():\n            if element.tag == 'a':\n                key = 'href'\n            elif element.tag == 'img':\n                key = 'src'\n            else:\n                continue\n\n            url = element.get(key)\n            new_url = self.path_to_url(url)\n            element.set(key, new_url)\n\n        return root\n\n    def path_to_url(self, url):\n        scheme, netloc, path, params, query, fragment = urlparse(url)\n\n        if (scheme or netloc or not path or url.startswith('/')\n                or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]):\n            # Ignore URLs unless they are a relative link to a source file.\n            # AMP_SUBSTITUTE is used internally by Markdown only for email.\n            # No '.' in the last part of a path indicates path does not point to a file.\n            return url\n\n        # Determine the filepath of the target.\n        target_path = os.path.join(os.path.dirname(self.file.src_path), path)\n        target_path = os.path.normpath(target_path).lstrip(os.sep)\n\n        # Validate that the target exists in files collection.\n        if target_path not in self.files:\n            log.warning(\n                \"Documentation file '{}' contains a link to '{}' which is not found \"\n                \"in the documentation files.\".format(self.file.src_path, target_path)\n            )\n            return url\n        target_file = self.files.get_file_from_path(target_path)\n        path = target_file.url_relative_to(self.file)\n        components = (scheme, netloc, path, params, query, fragment)\n        return urlunparse(components)\n\n\nclass _RelativePathExtension(Extension):\n    \"\"\"\n    The Extension class is what we pass to markdown, it then\n    registers the Treeprocessor.\n    \"\"\"\n\n    def __init__(self, file, files):\n        self.file = file\n        self.files = files\n\n    def extendMarkdown(self, md, md_globals):\n        relpath = _RelativePathTreeprocessor(self.file, self.files)\n        md.treeprocessors.add(\"relpath\", relpath, \"_end\")\n", "path": "mkdocs/structure/pages.py"}]}