We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Make syntax highlighting optional
It would be nice to have an option to disable the prettify class from being added to the pre-tag. Personally, I prefer using another highlighter that doesn't rely on extra classes.


--- 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/build.py`
Content:
```
1 # coding: utf-8
2 from __future__ import print_function
3 
4 from mkdocs import nav, toc, utils
5 from mkdocs.compat import urljoin, urlparse, urlunparse, PY2
6 import jinja2
7 import markdown
8 import os
9 import re
10 import json
11 
12 
13 class PathToURL(object):
14     def __init__(self, template, nav=None):
15         self.template = template
16         self.nav = nav
17 
18     def __call__(self, match):
19         url = match.groups()[0]
20         scheme, netloc, path, query, query, fragment = urlparse(url)
21 
22         if scheme or netloc:
23             # Ignore URLs unless they are a relative link to a markdown file.
24             return self.template % url
25 
26         if self.nav and not utils.is_markdown_file(path):
27             path = utils.create_media_urls(self.nav, [path])[0]
28         elif self.nav:
29             # If the site navigation has been provided, then validate
30             # the internal hyperlink, making sure the target actually exists.
31             target_file = self.nav.file_context.make_absolute(path)
32             if target_file not in self.nav.source_files:
33                 source_file = self.nav.file_context.current_file
34                 msg = (
35                     'The page "%s" contained a hyperlink to "%s" which '
36                     'is not listed in the "pages" configuration.'
37                 )
38                 assert False, msg % (source_file, target_file)
39             path = utils.get_url_path(target_file, self.nav.use_directory_urls)
40             path = self.nav.url_context.make_relative(path)
41         else:
42             path = utils.get_url_path(path).lstrip('/')
43 
44         # Convert the .md hyperlink to a relative hyperlink to the HTML page.
45         url = urlunparse((scheme, netloc, path, query, query, fragment))
46         return self.template % url
47 
48 
49 def convert_markdown(markdown_source, extensions=()):
50     """
51     Convert the Markdown source file to HTML content, and additionally
52     return the parsed table of contents, and a dictionary of any metadata
53     that was specified in the Markdown file.
54 
55     `extensions` is an optional sequence of Python Markdown extensions to add
56     to the default set.
57     """
58 
59     # Prepend a table of contents marker for the TOC extension
60     markdown_source = toc.pre_process(markdown_source)
61 
62     # Generate the HTML from the markdown source
63     md = markdown.Markdown(
64         extensions=['meta', 'toc', 'tables', 'fenced_code'] + list(extensions)
65     )
66     html_content = md.convert(markdown_source)
67     meta = md.Meta
68 
69     # Strip out the generated table of contents
70     (html_content, toc_html) = toc.post_process(html_content)
71 
72     # Post process the generated table of contents into a data structure
73     table_of_contents = toc.TableOfContents(toc_html)
74 
75     return (html_content, table_of_contents, meta)
76 
77 
78 def post_process_html(html_content, nav=None):
79 
80     anchor_sub = PathToURL('a href="%s"', nav)
81     html_content = re.sub(r'a href="([^"]*)"', anchor_sub, html_content)
82 
83     img_sub = PathToURL('src="%s"', nav)
84     html_content = re.sub(r'src="([^"]*)"', img_sub, html_content)
85 
86     html_content = html_content.replace('<pre>', '<pre class="prettyprint well">')
87 
88     return html_content
89 
90 
91 def get_context(page, content, nav, toc, meta, config):
92     site_name = config['site_name']
93 
94     if page.is_homepage or page.title is None:
95         page_title = site_name
96     else:
97         page_title = page.title + ' - ' + site_name
98 
99     if page.is_homepage:
100         page_description = config['site_description']
101     else:
102         page_description = None
103 
104     if config['site_url']:
105         base = config['site_url']
106         if not base.endswith('/'):
107             base += '/'
108         canonical_url = urljoin(base, page.abs_url.lstrip('/'))
109     else:
110         canonical_url = None
111 
112     if config['site_favicon']:
113         site_favicon = nav.url_context.make_relative('/' + config['site_favicon'])
114     else:
115         site_favicon = None
116 
117     extra_javascript = utils.create_media_urls(nav=nav, url_list=config['extra_javascript'])
118 
119     extra_css = utils.create_media_urls(nav=nav, url_list=config['extra_css'])
120 
121     return {
122         'site_name': site_name,
123         'site_author': config['site_author'],
124         'favicon': site_favicon,
125 
126         'page_title': page_title,
127         'page_description': page_description,
128 
129         'content': content,
130         'toc': toc,
131         'nav': nav,
132         'meta': meta,
133 
134         'base_url': nav.url_context.make_relative('/'),
135         'homepage_url': nav.homepage.url,
136         'canonical_url': canonical_url,
137 
138         'current_page': page,
139         'previous_page': page.previous_page,
140         'next_page': page.next_page,
141 
142         # Note that there's intentionally repetition here. Rather than simply
143         # provide the config dictionary we instead pass everything explicitly.
144         #
145         # This helps ensure that we can throughly document the context that
146         # gets passed to themes.
147         'repo_url': config['repo_url'],
148         'repo_name': config['repo_name'],
149 
150         'extra_css': extra_css,
151         'extra_javascript': extra_javascript,
152 
153         'include_nav': config['include_nav'],
154         'include_next_prev': config['include_next_prev'],
155         'include_search': config['include_search'],
156 
157         'copyright': config['copyright'],
158         'google-analytics': config['google-analytics']
159     }
160 
161 
162 def build_pages(config, dump_json=False):
163     """
164     Builds all the pages and writes them into the build directory.
165     """
166     site_navigation = nav.SiteNavigation(config['pages'], config['use_directory_urls'])
167     loader = jinja2.FileSystemLoader(config['theme_dir'])
168     env = jinja2.Environment(loader=loader)
169 
170     for page in site_navigation.walk_pages():
171         # Read the input file
172         input_path = os.path.join(config['docs_dir'], page.input_path)
173         input_content = open(input_path, 'r').read()
174         if PY2:
175             input_content = input_content.decode('utf-8')
176 
177         # Process the markdown text
178         html_content, table_of_contents, meta = convert_markdown(
179             input_content, extensions=config['markdown_extensions']
180         )
181         html_content = post_process_html(html_content, site_navigation)
182 
183         context = get_context(
184             page, html_content, site_navigation,
185             table_of_contents, meta, config
186         )
187 
188         # Allow 'template:' override in md source files.
189         if 'template' in meta:
190             template = env.get_template(meta['template'][0])
191         else:
192             template = env.get_template('base.html')
193 
194         # Render the template.
195         output_content = template.render(context)
196 
197         # Write the output file.
198         output_path = os.path.join(config['site_dir'], page.output_path)
199         if dump_json:
200             json_context = {
201                 'content': context['content'],
202                 'title': context['current_page'].title,
203                 'url': context['current_page'].abs_url,
204                 'language': 'en',
205             }
206             utils.write_file(json.dumps(json_context, indent=4).encode('utf-8'), output_path.replace('.html', '.json'))
207         else:
208             utils.write_file(output_content.encode('utf-8'), output_path)
209 
210 
211 def build(config, live_server=False, dump_json=False, clean_site_dir=False):
212     """
213     Perform a full site build.
214     """
215     if clean_site_dir:
216         print("Cleaning site directory")
217         utils.clean_directory(config['site_dir'])
218     if not live_server:
219         print("Building documentation to directory: %s" % config['site_dir'])
220         if not clean_site_dir and site_directory_contains_stale_files(config['site_dir']):
221             print("Directory %s contains stale files. Use --clean to remove them." % config['site_dir'])
222 
223     if dump_json:
224         build_pages(config, dump_json=True)
225     else:
226         # Reversed as we want to take the media files from the builtin theme
227         # and then from the custom theme_dir so the custom versions take take
228         # precedence.
229         for theme_dir in reversed(config['theme_dir']):
230             utils.copy_media_files(theme_dir, config['site_dir'])
231         utils.copy_media_files(config['docs_dir'], config['site_dir'])
232         build_pages(config)
233 
234 
235 def site_directory_contains_stale_files(site_directory):
236     """
237     Check if the site directory contains stale files from a previous build.
238     Right now the check returns true if the directory is not empty.
239     A more sophisticated approach should be found to trigger only if there are
240     files that won't be overwritten anyway.
241     """
242     if os.path.exists(site_directory):
243         if os.listdir(site_directory):
244             return True
245     return False
246
```
--- 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/build.py b/mkdocs/build.py
--- a/mkdocs/build.py
+++ b/mkdocs/build.py
@@ -83,8 +83,6 @@
     img_sub = PathToURL('src="%s"', nav)
     html_content = re.sub(r'src="([^"]*)"', img_sub, html_content)
 
-    html_content = html_content.replace('<pre>', '<pre class="prettyprint well">')
-
     return html_content

{"golden_diff": "diff --git a/mkdocs/build.py b/mkdocs/build.py\n--- a/mkdocs/build.py\n+++ b/mkdocs/build.py\n@@ -83,8 +83,6 @@\n     img_sub = PathToURL('src=\"%s\"', nav)\n     html_content = re.sub(r'src=\"([^\"]*)\"', img_sub, html_content)\n \n-    html_content = html_content.replace('<pre>', '<pre class=\"prettyprint well\">')\n-\n     return html_content\n", "issue": "Make syntax highlighting optional\nIt would be nice to have an option to disable the prettify class from being added to the pre-tag. Personally, I prefer using another highlighter that doesn't rely on extra classes.\n\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import print_function\n\nfrom mkdocs import nav, toc, utils\nfrom mkdocs.compat import urljoin, urlparse, urlunparse, PY2\nimport jinja2\nimport markdown\nimport os\nimport re\nimport json\n\n\nclass PathToURL(object):\n    def __init__(self, template, nav=None):\n        self.template = template\n        self.nav = nav\n\n    def __call__(self, match):\n        url = match.groups()[0]\n        scheme, netloc, path, query, query, fragment = urlparse(url)\n\n        if scheme or netloc:\n            # Ignore URLs unless they are a relative link to a markdown file.\n            return self.template % url\n\n        if self.nav and not utils.is_markdown_file(path):\n            path = utils.create_media_urls(self.nav, [path])[0]\n        elif self.nav:\n            # If the site navigation has been provided, then validate\n            # the internal hyperlink, making sure the target actually exists.\n            target_file = self.nav.file_context.make_absolute(path)\n            if target_file not in self.nav.source_files:\n                source_file = self.nav.file_context.current_file\n                msg = (\n                    'The page \"%s\" contained a hyperlink to \"%s\" which '\n                    'is not listed in the \"pages\" configuration.'\n                )\n                assert False, msg % (source_file, target_file)\n            path = utils.get_url_path(target_file, self.nav.use_directory_urls)\n            path = self.nav.url_context.make_relative(path)\n        else:\n            path = utils.get_url_path(path).lstrip('/')\n\n        # Convert the .md hyperlink to a relative hyperlink to the HTML page.\n        url = urlunparse((scheme, netloc, path, query, query, fragment))\n        return self.template % url\n\n\ndef convert_markdown(markdown_source, extensions=()):\n    \"\"\"\n    Convert the Markdown source file to HTML content, and additionally\n    return the parsed table of contents, and a dictionary of any metadata\n    that was specified in the Markdown file.\n\n    `extensions` is an optional sequence of Python Markdown extensions to add\n    to the default set.\n    \"\"\"\n\n    # Prepend a table of contents marker for the TOC extension\n    markdown_source = toc.pre_process(markdown_source)\n\n    # Generate the HTML from the markdown source\n    md = markdown.Markdown(\n        extensions=['meta', 'toc', 'tables', 'fenced_code'] + list(extensions)\n    )\n    html_content = md.convert(markdown_source)\n    meta = md.Meta\n\n    # Strip out the generated table of contents\n    (html_content, toc_html) = toc.post_process(html_content)\n\n    # Post process the generated table of contents into a data structure\n    table_of_contents = toc.TableOfContents(toc_html)\n\n    return (html_content, table_of_contents, meta)\n\n\ndef post_process_html(html_content, nav=None):\n\n    anchor_sub = PathToURL('a href=\"%s\"', nav)\n    html_content = re.sub(r'a href=\"([^\"]*)\"', anchor_sub, html_content)\n\n    img_sub = PathToURL('src=\"%s\"', nav)\n    html_content = re.sub(r'src=\"([^\"]*)\"', img_sub, html_content)\n\n    html_content = html_content.replace('<pre>', '<pre class=\"prettyprint well\">')\n\n    return html_content\n\n\ndef get_context(page, content, nav, toc, meta, config):\n    site_name = config['site_name']\n\n    if page.is_homepage or page.title is None:\n        page_title = site_name\n    else:\n        page_title = page.title + ' - ' + site_name\n\n    if page.is_homepage:\n        page_description = config['site_description']\n    else:\n        page_description = None\n\n    if config['site_url']:\n        base = config['site_url']\n        if not base.endswith('/'):\n            base += '/'\n        canonical_url = urljoin(base, page.abs_url.lstrip('/'))\n    else:\n        canonical_url = None\n\n    if config['site_favicon']:\n        site_favicon = nav.url_context.make_relative('/' + config['site_favicon'])\n    else:\n        site_favicon = None\n\n    extra_javascript = utils.create_media_urls(nav=nav, url_list=config['extra_javascript'])\n\n    extra_css = utils.create_media_urls(nav=nav, url_list=config['extra_css'])\n\n    return {\n        'site_name': site_name,\n        'site_author': config['site_author'],\n        'favicon': site_favicon,\n\n        'page_title': page_title,\n        'page_description': page_description,\n\n        'content': content,\n        'toc': toc,\n        'nav': nav,\n        'meta': meta,\n\n        'base_url': nav.url_context.make_relative('/'),\n        'homepage_url': nav.homepage.url,\n        'canonical_url': canonical_url,\n\n        'current_page': page,\n        'previous_page': page.previous_page,\n        'next_page': page.next_page,\n\n        # Note that there's intentionally repetition here. Rather than simply\n        # provide the config dictionary we instead pass everything explicitly.\n        #\n        # This helps ensure that we can throughly document the context that\n        # gets passed to themes.\n        'repo_url': config['repo_url'],\n        'repo_name': config['repo_name'],\n\n        'extra_css': extra_css,\n        'extra_javascript': extra_javascript,\n\n        'include_nav': config['include_nav'],\n        'include_next_prev': config['include_next_prev'],\n        'include_search': config['include_search'],\n\n        'copyright': config['copyright'],\n        'google-analytics': config['google-analytics']\n    }\n\n\ndef build_pages(config, dump_json=False):\n    \"\"\"\n    Builds all the pages and writes them into the build directory.\n    \"\"\"\n    site_navigation = nav.SiteNavigation(config['pages'], config['use_directory_urls'])\n    loader = jinja2.FileSystemLoader(config['theme_dir'])\n    env = jinja2.Environment(loader=loader)\n\n    for page in site_navigation.walk_pages():\n        # Read the input file\n        input_path = os.path.join(config['docs_dir'], page.input_path)\n        input_content = open(input_path, 'r').read()\n        if PY2:\n            input_content = input_content.decode('utf-8')\n\n        # Process the markdown text\n        html_content, table_of_contents, meta = convert_markdown(\n            input_content, extensions=config['markdown_extensions']\n        )\n        html_content = post_process_html(html_content, site_navigation)\n\n        context = get_context(\n            page, html_content, site_navigation,\n            table_of_contents, meta, config\n        )\n\n        # Allow 'template:' override in md source files.\n        if 'template' in meta:\n            template = env.get_template(meta['template'][0])\n        else:\n            template = env.get_template('base.html')\n\n        # Render the template.\n        output_content = template.render(context)\n\n        # Write the output file.\n        output_path = os.path.join(config['site_dir'], page.output_path)\n        if dump_json:\n            json_context = {\n                'content': context['content'],\n                'title': context['current_page'].title,\n                'url': context['current_page'].abs_url,\n                'language': 'en',\n            }\n            utils.write_file(json.dumps(json_context, indent=4).encode('utf-8'), output_path.replace('.html', '.json'))\n        else:\n            utils.write_file(output_content.encode('utf-8'), output_path)\n\n\ndef build(config, live_server=False, dump_json=False, clean_site_dir=False):\n    \"\"\"\n    Perform a full site build.\n    \"\"\"\n    if clean_site_dir:\n        print(\"Cleaning site directory\")\n        utils.clean_directory(config['site_dir'])\n    if not live_server:\n        print(\"Building documentation to directory: %s\" % config['site_dir'])\n        if not clean_site_dir and site_directory_contains_stale_files(config['site_dir']):\n            print(\"Directory %s contains stale files. Use --clean to remove them.\" % config['site_dir'])\n\n    if dump_json:\n        build_pages(config, dump_json=True)\n    else:\n        # Reversed as we want to take the media files from the builtin theme\n        # and then from the custom theme_dir so the custom versions take take\n        # precedence.\n        for theme_dir in reversed(config['theme_dir']):\n            utils.copy_media_files(theme_dir, config['site_dir'])\n        utils.copy_media_files(config['docs_dir'], config['site_dir'])\n        build_pages(config)\n\n\ndef site_directory_contains_stale_files(site_directory):\n    \"\"\"\n    Check if the site directory contains stale files from a previous build.\n    Right now the check returns true if the directory is not empty.\n    A more sophisticated approach should be found to trigger only if there are\n    files that won't be overwritten anyway.\n    \"\"\"\n    if os.path.exists(site_directory):\n        if os.listdir(site_directory):\n            return True\n    return False\n", "path": "mkdocs/build.py"}], "after_files": [{"content": "# coding: utf-8\nfrom __future__ import print_function\n\nfrom mkdocs import nav, toc, utils\nfrom mkdocs.compat import urljoin, urlparse, urlunparse, PY2\nimport jinja2\nimport markdown\nimport os\nimport re\nimport json\n\n\nclass PathToURL(object):\n    def __init__(self, template, nav=None):\n        self.template = template\n        self.nav = nav\n\n    def __call__(self, match):\n        url = match.groups()[0]\n        scheme, netloc, path, query, query, fragment = urlparse(url)\n\n        if scheme or netloc:\n            # Ignore URLs unless they are a relative link to a markdown file.\n            return self.template % url\n\n        if self.nav and not utils.is_markdown_file(path):\n            path = utils.create_media_urls(self.nav, [path])[0]\n        elif self.nav:\n            # If the site navigation has been provided, then validate\n            # the internal hyperlink, making sure the target actually exists.\n            target_file = self.nav.file_context.make_absolute(path)\n            if target_file not in self.nav.source_files:\n                source_file = self.nav.file_context.current_file\n                msg = (\n                    'The page \"%s\" contained a hyperlink to \"%s\" which '\n                    'is not listed in the \"pages\" configuration.'\n                )\n                assert False, msg % (source_file, target_file)\n            path = utils.get_url_path(target_file, self.nav.use_directory_urls)\n            path = self.nav.url_context.make_relative(path)\n        else:\n            path = utils.get_url_path(path).lstrip('/')\n\n        # Convert the .md hyperlink to a relative hyperlink to the HTML page.\n        url = urlunparse((scheme, netloc, path, query, query, fragment))\n        return self.template % url\n\n\ndef convert_markdown(markdown_source, extensions=()):\n    \"\"\"\n    Convert the Markdown source file to HTML content, and additionally\n    return the parsed table of contents, and a dictionary of any metadata\n    that was specified in the Markdown file.\n\n    `extensions` is an optional sequence of Python Markdown extensions to add\n    to the default set.\n    \"\"\"\n\n    # Prepend a table of contents marker for the TOC extension\n    markdown_source = toc.pre_process(markdown_source)\n\n    # Generate the HTML from the markdown source\n    md = markdown.Markdown(\n        extensions=['meta', 'toc', 'tables', 'fenced_code'] + list(extensions)\n    )\n    html_content = md.convert(markdown_source)\n    meta = md.Meta\n\n    # Strip out the generated table of contents\n    (html_content, toc_html) = toc.post_process(html_content)\n\n    # Post process the generated table of contents into a data structure\n    table_of_contents = toc.TableOfContents(toc_html)\n\n    return (html_content, table_of_contents, meta)\n\n\ndef post_process_html(html_content, nav=None):\n\n    anchor_sub = PathToURL('a href=\"%s\"', nav)\n    html_content = re.sub(r'a href=\"([^\"]*)\"', anchor_sub, html_content)\n\n    img_sub = PathToURL('src=\"%s\"', nav)\n    html_content = re.sub(r'src=\"([^\"]*)\"', img_sub, html_content)\n\n    return html_content\n\n\ndef get_context(page, content, nav, toc, meta, config):\n    site_name = config['site_name']\n\n    if page.is_homepage or page.title is None:\n        page_title = site_name\n    else:\n        page_title = page.title + ' - ' + site_name\n\n    if page.is_homepage:\n        page_description = config['site_description']\n    else:\n        page_description = None\n\n    if config['site_url']:\n        base = config['site_url']\n        if not base.endswith('/'):\n            base += '/'\n        canonical_url = urljoin(base, page.abs_url.lstrip('/'))\n    else:\n        canonical_url = None\n\n    if config['site_favicon']:\n        site_favicon = nav.url_context.make_relative('/' + config['site_favicon'])\n    else:\n        site_favicon = None\n\n    extra_javascript = utils.create_media_urls(nav=nav, url_list=config['extra_javascript'])\n\n    extra_css = utils.create_media_urls(nav=nav, url_list=config['extra_css'])\n\n    return {\n        'site_name': site_name,\n        'site_author': config['site_author'],\n        'favicon': site_favicon,\n\n        'page_title': page_title,\n        'page_description': page_description,\n\n        'content': content,\n        'toc': toc,\n        'nav': nav,\n        'meta': meta,\n\n        'base_url': nav.url_context.make_relative('/'),\n        'homepage_url': nav.homepage.url,\n        'canonical_url': canonical_url,\n\n        'current_page': page,\n        'previous_page': page.previous_page,\n        'next_page': page.next_page,\n\n        # Note that there's intentionally repetition here. Rather than simply\n        # provide the config dictionary we instead pass everything explicitly.\n        #\n        # This helps ensure that we can throughly document the context that\n        # gets passed to themes.\n        'repo_url': config['repo_url'],\n        'repo_name': config['repo_name'],\n\n        'extra_css': extra_css,\n        'extra_javascript': extra_javascript,\n\n        'include_nav': config['include_nav'],\n        'include_next_prev': config['include_next_prev'],\n        'include_search': config['include_search'],\n\n        'copyright': config['copyright'],\n        'google-analytics': config['google-analytics']\n    }\n\n\ndef build_pages(config, dump_json=False):\n    \"\"\"\n    Builds all the pages and writes them into the build directory.\n    \"\"\"\n    site_navigation = nav.SiteNavigation(config['pages'], config['use_directory_urls'])\n    loader = jinja2.FileSystemLoader(config['theme_dir'])\n    env = jinja2.Environment(loader=loader)\n\n    for page in site_navigation.walk_pages():\n        # Read the input file\n        input_path = os.path.join(config['docs_dir'], page.input_path)\n        input_content = open(input_path, 'r').read()\n        if PY2:\n            input_content = input_content.decode('utf-8')\n\n        # Process the markdown text\n        html_content, table_of_contents, meta = convert_markdown(\n            input_content, extensions=config['markdown_extensions']\n        )\n        html_content = post_process_html(html_content, site_navigation)\n\n        context = get_context(\n            page, html_content, site_navigation,\n            table_of_contents, meta, config\n        )\n\n        # Allow 'template:' override in md source files.\n        if 'template' in meta:\n            template = env.get_template(meta['template'][0])\n        else:\n            template = env.get_template('base.html')\n\n        # Render the template.\n        output_content = template.render(context)\n\n        # Write the output file.\n        output_path = os.path.join(config['site_dir'], page.output_path)\n        if dump_json:\n            json_context = {\n                'content': context['content'],\n                'title': context['current_page'].title,\n                'url': context['current_page'].abs_url,\n                'language': 'en',\n            }\n            utils.write_file(json.dumps(json_context, indent=4).encode('utf-8'), output_path.replace('.html', '.json'))\n        else:\n            utils.write_file(output_content.encode('utf-8'), output_path)\n\n\ndef build(config, live_server=False, dump_json=False, clean_site_dir=False):\n    \"\"\"\n    Perform a full site build.\n    \"\"\"\n    if clean_site_dir:\n        print(\"Cleaning site directory\")\n        utils.clean_directory(config['site_dir'])\n    if not live_server:\n        print(\"Building documentation to directory: %s\" % config['site_dir'])\n        if not clean_site_dir and site_directory_contains_stale_files(config['site_dir']):\n            print(\"Directory %s contains stale files. Use --clean to remove them.\" % config['site_dir'])\n\n    if dump_json:\n        build_pages(config, dump_json=True)\n    else:\n        # Reversed as we want to take the media files from the builtin theme\n        # and then from the custom theme_dir so the custom versions take take\n        # precedence.\n        for theme_dir in reversed(config['theme_dir']):\n            utils.copy_media_files(theme_dir, config['site_dir'])\n        utils.copy_media_files(config['docs_dir'], config['site_dir'])\n        build_pages(config)\n\n\ndef site_directory_contains_stale_files(site_directory):\n    \"\"\"\n    Check if the site directory contains stale files from a previous build.\n    Right now the check returns true if the directory is not empty.\n    A more sophisticated approach should be found to trigger only if there are\n    files that won't be overwritten anyway.\n    \"\"\"\n    if os.path.exists(site_directory):\n        if os.listdir(site_directory):\n            return True\n    return False\n", "path": "mkdocs/build.py"}]}