Files
mkdocs/dev-guide/api/index.html
2024-08-30 13:33:35 +01:00

1653 lines
47 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="MkDocs Team">
<link rel="canonical" href="https://www.mkdocs.org/dev-guide/api/">
<link rel="shortcut icon" href="../../img/favicon.ico">
<title>API Reference - MkDocs</title>
<link href="../../css/bootstrap.min.css" rel="stylesheet">
<link href="../../css/font-awesome.min.css" rel="stylesheet">
<link href="../../css/base.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css">
<link href="../../assets/_mkdocstrings.css" rel="stylesheet">
<link href="../../css/extra.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/yaml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/django.min.js"></script>
<script>hljs.highlightAll();</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-274394082"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', "G-274394082");
</script>
</head>
<body>
<div class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="../..">MkDocs</a>
<!-- Expander button -->
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar-collapse">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Expanded navigation -->
<div id="navbar-collapse" class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li class="navitem">
<a href="../.." class="nav-link">Home</a>
</li>
<li class="navitem">
<a href="../../getting-started/" class="nav-link">Getting Started</a>
</li>
<li class="dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">User Guide <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="../../user-guide/" class="dropdown-item">User Guide</a>
</li>
<li>
<a href="../../user-guide/installation/" class="dropdown-item">Installation</a>
</li>
<li>
<a href="../../user-guide/writing-your-docs/" class="dropdown-item">Writing Your Docs</a>
</li>
<li>
<a href="../../user-guide/choosing-your-theme/" class="dropdown-item">Choosing Your Theme</a>
</li>
<li>
<a href="../../user-guide/customizing-your-theme/" class="dropdown-item">Customizing Your Theme</a>
</li>
<li>
<a href="../../user-guide/localizing-your-theme/" class="dropdown-item">Localizing Your Theme</a>
</li>
<li>
<a href="../../user-guide/configuration/" class="dropdown-item">Configuration</a>
</li>
<li>
<a href="../../user-guide/cli/" class="dropdown-item">Command Line Interface</a>
</li>
<li>
<a href="../../user-guide/deploying-your-docs/" class="dropdown-item">Deploying Your Docs</a>
</li>
</ul>
</li>
<li class="dropdown active">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Developer Guide <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="../" class="dropdown-item">Developer Guide</a>
</li>
<li>
<a href="../themes/" class="dropdown-item">Themes</a>
</li>
<li>
<a href="../translations/" class="dropdown-item">Translations</a>
</li>
<li>
<a href="../plugins/" class="dropdown-item">Plugins</a>
</li>
<li>
<a href="./" class="dropdown-item active">API Reference</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">About <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="../../about/release-notes/" class="dropdown-item">Release Notes</a>
</li>
<li>
<a href="../../about/contributing/" class="dropdown-item">Contributing</a>
</li>
<li>
<a href="../../about/license/" class="dropdown-item">License</a>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a href="#" class="nav-link" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fa fa-search"></i> Search
</a>
</li>
<li class="nav-item">
<a rel="prev" href="../plugins/" class="nav-link">
<i class="fa fa-arrow-left"></i> Previous
</a>
</li>
<li class="nav-item">
<a rel="next" href="../../about/release-notes/" class="nav-link">
Next <i class="fa fa-arrow-right"></i>
</a>
</li>
<li class="nav-item">
<a href="https://github.com/mkdocs/mkdocs/blob/master/docs/dev-guide/api.md" class="nav-link"><i class="fa fa-github"></i> Edit on GitHub</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-3"><div class="navbar-light navbar-expand-md bs-sidebar hidden-print affix" role="complementary">
<div class="navbar-header">
<button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target="#toc-collapse" title="Table of Contents">
<span class="fa fa-angle-down"></span>
</button>
</div>
<div id="toc-collapse" class="navbar-collapse collapse card bg-secondary">
<ul class="nav flex-column">
<li class="nav-item" data-level="1"><a href="#api-reference" class="nav-link">API reference</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#mkdocs.structure.files.Files" class="nav-link">Files</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#mkdocs.structure.files.File" class="nav-link">File</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#mkdocs.config.base.Config" class="nav-link">Config</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#mkdocs.utils.templates.TemplateContext" class="nav-link">TemplateContext</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#mkdocs.livereload.LiveReloadServer" class="nav-link">LiveReloadServer</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div></div>
<div class="col-md-9" role="main">
<h1 id="api-reference">API reference<a class="headerlink" href="#api-reference" title="Permanent link"></a></h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The main entry point to the API is through <a href="../plugins/#events">Events</a> that are received by plugins. These events' descriptions link back to this page.</p>
</div>
<div class="doc doc-object doc-class">
<h2 id="mkdocs.structure.files.Files" class="doc doc-heading">
<code>mkdocs.structure.files.Files</code>
<a href="#mkdocs.structure.files.Files" class="headerlink" title="Permanent link"></a></h2>
<div class="doc doc-contents first">
<p>A collection of <a class="autorefs autorefs-internal" href="#mkdocs.structure.files.File">File</a> objects.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.Files.src_paths" class="doc doc-heading">
<code class="highlight language-python">src_paths: dict[str, File]</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>
<a href="#mkdocs.structure.files.Files.src_paths" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Soft-deprecated, prefer <code>src_uris</code>.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.Files.src_uris" class="doc doc-heading">
<code class="highlight language-python">src_uris: Mapping[str, File]</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>
<a href="#mkdocs.structure.files.Files.src_uris" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>A mapping containing every file, with the keys being their
<a class="autorefs autorefs-internal" href="#mkdocs.structure.files.File.src_uri"><code>src_uri</code></a>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.__iter__" class="doc doc-heading">
<code class="highlight language-python">__iter__() -&gt; Iterator[File]</code>
<a href="#mkdocs.structure.files.Files.__iter__" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Iterate over the files within.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.__len__" class="doc doc-heading">
<code class="highlight language-python">__len__() -&gt; int</code>
<a href="#mkdocs.structure.files.Files.__len__" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The number of files within.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.__contains__" class="doc doc-heading">
<code class="highlight language-python">__contains__(path: str) -&gt; bool</code>
<a href="#mkdocs.structure.files.Files.__contains__" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Soft-deprecated, prefer <code>get_file_from_path(path) is not None</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.get_file_from_path" class="doc doc-heading">
<code class="highlight language-python">get_file_from_path(path: str) -&gt; File | None</code>
<a href="#mkdocs.structure.files.Files.get_file_from_path" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return a File instance with File.src_uri equal to path.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.append" class="doc doc-heading">
<code class="highlight language-python">append(file: File) -&gt; None</code>
<a href="#mkdocs.structure.files.Files.append" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Add file to the Files collection.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.remove" class="doc doc-heading">
<code class="highlight language-python">remove(file: File) -&gt; None</code>
<a href="#mkdocs.structure.files.Files.remove" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Remove file from Files collection.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.copy_static_files" class="doc doc-heading">
<code class="highlight language-python">copy_static_files(dirty: bool = False, *, inclusion: Callable[[InclusionLevel], bool] = InclusionLevel.is_included) -&gt; None</code>
<a href="#mkdocs.structure.files.Files.copy_static_files" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Copy static files from source to destination.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.documentation_pages" class="doc doc-heading">
<code class="highlight language-python">documentation_pages(*, inclusion: Callable[[InclusionLevel], bool] = InclusionLevel.is_included) -&gt; Sequence[File]</code>
<a href="#mkdocs.structure.files.Files.documentation_pages" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return iterable of all Markdown page file objects.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.static_pages" class="doc doc-heading">
<code class="highlight language-python">static_pages() -&gt; Sequence[File]</code>
<a href="#mkdocs.structure.files.Files.static_pages" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return iterable of all static page file objects.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.media_files" class="doc doc-heading">
<code class="highlight language-python">media_files() -&gt; Sequence[File]</code>
<a href="#mkdocs.structure.files.Files.media_files" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return iterable of all file objects which are not documentation or static pages.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.javascript_files" class="doc doc-heading">
<code class="highlight language-python">javascript_files() -&gt; Sequence[File]</code>
<a href="#mkdocs.structure.files.Files.javascript_files" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return iterable of all javascript file objects.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.css_files" class="doc doc-heading">
<code class="highlight language-python">css_files() -&gt; Sequence[File]</code>
<a href="#mkdocs.structure.files.Files.css_files" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return iterable of all CSS file objects.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.Files.add_files_from_theme" class="doc doc-heading">
<code class="highlight language-python">add_files_from_theme(env: jinja2.Environment, config: MkDocsConfig) -&gt; None</code>
<a href="#mkdocs.structure.files.Files.add_files_from_theme" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Retrieve static files from Jinja environment and add to collection.</p>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="mkdocs.structure.files.File" class="doc doc-heading">
<code>mkdocs.structure.files.File</code>
<a href="#mkdocs.structure.files.File" class="headerlink" title="Permanent link"></a></h2>
<div class="doc doc-contents first">
<p>A MkDocs File object.</p>
<p>It represents how the contents of one file should be populated in the destination site.</p>
<p>A file always has its <code>abs_dest_path</code> (obtained by joining <code>dest_dir</code> and <code>dest_path</code>),
where the <code>dest_dir</code> is understood to be the <em>site</em> directory.</p>
<p><code>content_bytes</code>/<code>content_string</code> (new in MkDocs 1.6) can always be used to obtain the file's
content. But it may be backed by one of the two sources:</p>
<ul>
<li>
<p>A physical source file at <code>abs_src_path</code> (by default obtained by joining <code>src_dir</code> and
<code>src_uri</code>). <code>src_dir</code> is understood to be the <em>docs</em> directory.</p>
<p>Then <code>content_bytes</code>/<code>content_string</code> will read the file at <code>abs_src_path</code>.</p>
<p><code>src_dir</code> <em>should</em> be populated for real files and should be <code>None</code> for generated files.</p>
</li>
<li>
<p>Since MkDocs 1.6 a file may alternatively be stored in memory - <code>content_string</code>/<code>content_bytes</code>.</p>
<p>Then <code>src_dir</code> and <code>abs_src_path</code> will remain <code>None</code>. <code>content_bytes</code>/<code>content_string</code> need
to be written to, or populated through the <code>content</code> argument in the constructor.</p>
<p>But <code>src_uri</code> is still populated for such files as well! The virtual file pretends as if it
originated from that path in the <code>docs</code> directory, and other values are derived.</p>
</li>
</ul>
<p>For static files the file is just copied to the destination, and <code>dest_uri</code> equals <code>src_uri</code>.</p>
<p>For Markdown files (determined by the file extension in <code>src_uri</code>) the destination content
will be the rendered content, and <code>dest_uri</code> will have the <code>.html</code> extension and some
additional transformations to the path, based on <code>use_directory_urls</code>.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.src_uri" class="doc doc-heading">
<code class="highlight language-python">src_uri: str</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.src_uri" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The pure path (always '/'-separated) of the source file relative to the source directory.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.generated_by" class="doc doc-heading">
<code class="highlight language-python">generated_by: str | None = None</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-class-attribute"><code>class-attribute</code></small>
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.generated_by" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>If not None, indicates that a plugin generated this file on the fly.</p>
<p>The value is the plugin's entrypoint name and can be used to find the plugin by key in the PluginCollection.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.dest_path" class="doc doc-heading">
<code class="highlight language-python">dest_path: str</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
</span>
<a href="#mkdocs.structure.files.File.dest_path" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Same as <code>dest_uri</code> (and synchronized with it) but will use backslashes on Windows. Discouraged.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.src_path" class="doc doc-heading">
<code class="highlight language-python">src_path: str = path</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
</span>
<a href="#mkdocs.structure.files.File.src_path" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Same as <code>src_uri</code> (and synchronized with it) but will use backslashes on Windows. Discouraged.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.src_dir" class="doc doc-heading">
<code class="highlight language-python">src_dir: str | None = src_dir</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.src_dir" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The OS path of the top-level directory that the source file originates from.</p>
<p>Assumed to be the <em>docs_dir</em>; not populated for generated files.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.dest_dir" class="doc doc-heading">
<code class="highlight language-python">dest_dir: str = dest_dir</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.dest_dir" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The OS path of the destination directory (top-level site_dir) that the file should be copied to.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.use_directory_urls" class="doc doc-heading">
<code class="highlight language-python">use_directory_urls: bool = use_directory_urls</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.use_directory_urls" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Whether directory URLs ('foo/') should be used or not ('foo.html').</p>
<p>If <code>False</code>, a Markdown file is mapped to an HTML file of the same name (the file extension is
changed to <code>.html</code>). If True, a Markdown file is mapped to an HTML index file (<code>index.html</code>)
nested in a directory using the "name" of the file in <code>path</code>. Non-Markdown files retain their
original path.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.inclusion" class="doc doc-heading">
<code class="highlight language-python">inclusion: InclusionLevel = inclusion</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-class-attribute"><code>class-attribute</code></small>
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.inclusion" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Whether the file will be excluded from the built site.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.name" class="doc doc-heading">
<code class="highlight language-python">name = cached_property(_get_stem)</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-class-attribute"><code>class-attribute</code></small>
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.name" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return the name of the file without its extension.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.dest_uri" class="doc doc-heading">
<code class="highlight language-python">dest_uri = cached_property(_get_dest_path)</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-class-attribute"><code>class-attribute</code></small>
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.dest_uri" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The pure path (always '/'-separated) of the destination file relative to the destination directory.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.url" class="doc doc-heading">
<code class="highlight language-python">url = cached_property(_get_url)</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-class-attribute"><code>class-attribute</code></small>
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.structure.files.File.url" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The URI of the destination file relative to the destination directory as a string.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.abs_src_path" class="doc doc-heading">
<code class="highlight language-python">abs_src_path: str | None</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-cached"><code>cached</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>
<a href="#mkdocs.structure.files.File.abs_src_path" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The absolute concrete path of the source file. Will use backslashes on Windows.</p>
<p>Note: do not use this path to read the file, prefer <code>content_bytes</code>/<code>content_string</code>.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.abs_dest_path" class="doc doc-heading">
<code class="highlight language-python">abs_dest_path: str</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-cached"><code>cached</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>
<a href="#mkdocs.structure.files.File.abs_dest_path" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>The absolute concrete path of the destination file. Will use backslashes on Windows.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.content_bytes" class="doc doc-heading">
<code class="highlight language-python">content_bytes: bytes</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
</span>
<a href="#mkdocs.structure.files.File.content_bytes" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Get the content of this file as a bytestring.</p>
<p>May raise if backed by a real file (<code>abs_src_path</code>) if it cannot be read.</p>
<p>If used as a setter, it defines the content of the file, and <code>abs_src_path</code> becomes unset.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.structure.files.File.content_string" class="doc doc-heading">
<code class="highlight language-python">content_string: str</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
</span>
<a href="#mkdocs.structure.files.File.content_string" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Get the content of this file as a string. Assumes UTF-8 encoding, may raise.</p>
<p>May also raise if backed by a real file (<code>abs_src_path</code>) if it cannot be read.</p>
<p>If used as a setter, it defines the content of the file, and <code>abs_src_path</code> becomes unset.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.generated" class="doc doc-heading">
<code class="highlight language-python">generated(config: MkDocsConfig, src_uri: str, *, content: str | bytes | None = None, abs_src_path: str | None = None, inclusion: InclusionLevel = InclusionLevel.UNDEFINED) -&gt; File</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-classmethod"><code>classmethod</code></small>
</span>
<a href="#mkdocs.structure.files.File.generated" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Create a virtual file, backed either by in-memory <code>content</code> or by a file at <code>abs_src_path</code>.</p>
<p>It will pretend to be a file in the docs dir at <code>src_uri</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.edit_uri" class="doc doc-heading">
<code class="highlight language-python">edit_uri() -&gt; str | None</code>
<a href="#mkdocs.structure.files.File.edit_uri" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>A path relative to the source repository to use for the "edit" button.</p>
<p>Defaults to <code>src_uri</code> and can be overwritten.
For generated files this should be set to <code>None</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.url_relative_to" class="doc doc-heading">
<code class="highlight language-python">url_relative_to(other: File | str) -&gt; str</code>
<a href="#mkdocs.structure.files.File.url_relative_to" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return url for file relative to other file.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.copy_file" class="doc doc-heading">
<code class="highlight language-python">copy_file(dirty: bool = False) -&gt; None</code>
<a href="#mkdocs.structure.files.File.copy_file" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Copy source file to destination, ensuring parent directories exist.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.is_documentation_page" class="doc doc-heading">
<code class="highlight language-python">is_documentation_page() -&gt; bool</code>
<a href="#mkdocs.structure.files.File.is_documentation_page" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return True if file is a Markdown page.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.is_static_page" class="doc doc-heading">
<code class="highlight language-python">is_static_page() -&gt; bool</code>
<a href="#mkdocs.structure.files.File.is_static_page" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return True if file is a static page (HTML, XML, JSON).</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.is_media_file" class="doc doc-heading">
<code class="highlight language-python">is_media_file() -&gt; bool</code>
<a href="#mkdocs.structure.files.File.is_media_file" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return True if file is not a documentation or static page.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.is_javascript" class="doc doc-heading">
<code class="highlight language-python">is_javascript() -&gt; bool</code>
<a href="#mkdocs.structure.files.File.is_javascript" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return True if file is a JavaScript file.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.structure.files.File.is_css" class="doc doc-heading">
<code class="highlight language-python">is_css() -&gt; bool</code>
<a href="#mkdocs.structure.files.File.is_css" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Return True if file is a CSS file.</p>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="mkdocs.config.base.Config" class="doc doc-heading">
<code>mkdocs.config.base.Config</code>
<a href="#mkdocs.config.base.Config" class="headerlink" title="Permanent link"></a></h2>
<div class="doc doc-contents first">
<p class="doc doc-class-bases">
Bases: <code><span title="collections.UserDict">UserDict</span></code></p>
<p>Base class for MkDocs configuration, plugin configuration (and sub-configuration) objects.</p>
<p>It should be subclassed and have <code>ConfigOption</code>s defined as attributes.
For examples, see mkdocs/contrib/search/<strong>init</strong>.py and mkdocs/config/defaults.py.</p>
<p>Behavior as it was prior to MkDocs 1.4 is now handled by LegacyConfig.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="mkdocs.config.base.Config.__new__" class="doc doc-heading">
<code class="highlight language-python">__new__(*args, **kwargs) -&gt; Config</code>
<a href="#mkdocs.config.base.Config.__new__" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Compatibility: allow referring to <code>LegacyConfig(...)</code> constructor as <code>Config(...)</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.config.base.Config.set_defaults" class="doc doc-heading">
<code class="highlight language-python">set_defaults() -&gt; None</code>
<a href="#mkdocs.config.base.Config.set_defaults" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Set the base config by going through each validator and getting the
default if it has one.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.config.base.Config.load_dict" class="doc doc-heading">
<code class="highlight language-python">load_dict(patch: dict) -&gt; None</code>
<a href="#mkdocs.config.base.Config.load_dict" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Load config options from a dictionary.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.config.base.Config.load_file" class="doc doc-heading">
<code class="highlight language-python">load_file(config_file: IO) -&gt; None</code>
<a href="#mkdocs.config.base.Config.load_file" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Load config options from the open file descriptor of a YAML file.</p>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="mkdocs.utils.templates.TemplateContext" class="doc doc-heading">
<code>mkdocs.utils.templates.TemplateContext</code>
<a href="#mkdocs.utils.templates.TemplateContext" class="headerlink" title="Permanent link"></a></h2>
<div class="doc doc-contents first">
<p class="doc doc-class-bases">
Bases: <code><span title="typing.TypedDict">TypedDict</span></code></p>
<div class="doc doc-children">
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.nav" class="doc doc-heading">
<code class="highlight language-python">nav: Navigation</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.nav" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.pages" class="doc doc-heading">
<code class="highlight language-python">pages: Sequence[File]</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.pages" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.base_url" class="doc doc-heading">
<code class="highlight language-python">base_url: str</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.base_url" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.extra_css" class="doc doc-heading">
<code class="highlight language-python">extra_css: Sequence[str]</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.extra_css" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.extra_javascript" class="doc doc-heading">
<code class="highlight language-python">extra_javascript: Sequence[str]</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.extra_javascript" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.mkdocs_version" class="doc doc-heading">
<code class="highlight language-python">mkdocs_version: str</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.mkdocs_version" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.build_date_utc" class="doc doc-heading">
<code class="highlight language-python">build_date_utc: datetime.datetime</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.build_date_utc" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.config" class="doc doc-heading">
<code class="highlight language-python">config: MkDocsConfig</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.config" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="mkdocs.utils.templates.TemplateContext.page" class="doc doc-heading">
<code class="highlight language-python">page: Page | None</code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-instance-attribute"><code>instance-attribute</code></small>
</span>
<a href="#mkdocs.utils.templates.TemplateContext.page" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="mkdocs.livereload.LiveReloadServer" class="doc doc-heading">
<code>mkdocs.livereload.LiveReloadServer</code>
<a href="#mkdocs.livereload.LiveReloadServer" class="headerlink" title="Permanent link"></a></h2>
<div class="doc doc-contents first">
<p class="doc doc-class-bases">
Bases: <code><span title="socketserver.ThreadingMixIn">ThreadingMixIn</span></code>, <code><span title="wsgiref.simple_server.WSGIServer">WSGIServer</span></code></p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="mkdocs.livereload.LiveReloadServer.watch" class="doc doc-heading">
<code class="highlight language-python">watch(path: str, func: None = None, *, recursive: bool = True) -&gt; None</code>
<a href="#mkdocs.livereload.LiveReloadServer.watch" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Add the 'path' to watched paths, call the function and reload when any file changes under it.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="mkdocs.livereload.LiveReloadServer.unwatch" class="doc doc-heading">
<code class="highlight language-python">unwatch(path: str) -&gt; None</code>
<a href="#mkdocs.livereload.LiveReloadServer.unwatch" class="headerlink" title="Permanent link"></a></h3>
<div class="doc doc-contents ">
<p>Stop watching file changes for path. Raises if there was no corresponding <code>watch</code> call.</p>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div>
<footer class="col-md-12">
<hr>
<p>Copyright &copy; 2014 <a href="https://twitter.com/starletdreaming">Tom Christie</a>, Maintained by the <a href="/about/release-notes/#maintenance-team">MkDocs Team</a>.</p>
<p>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a>.</p>
</footer>
<script src="../../js/jquery-3.6.0.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script>
var base_url = "../..",
shortcuts = {"help": 191, "next": 78, "previous": 80, "search": 83};
</script>
<script src="../../js/base.js"></script>
<script src="../../search/main.js"></script>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="searchModalLabel">Search</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<p>From here you can search these documents. Enter your search terms below.</p>
<form>
<div class="form-group">
<input type="search" class="form-control" placeholder="Search..." id="mkdocs-search-query" title="Type search term here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No results found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th style="width: 20%;">Keys</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="help shortcut"><kbd>?</kbd></td>
<td>Open this help</td>
</tr>
<tr>
<td class="next shortcut"><kbd>n</kbd></td>
<td>Next page</td>
</tr>
<tr>
<td class="prev shortcut"><kbd>p</kbd></td>
<td>Previous page</td>
</tr>
<tr>
<td class="search shortcut"><kbd>s</kbd></td>
<td>Search</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>