mkdocs API reference
103 public APIs from mkdocs (mkdocs/mkdocs) — 38 classes, 29 functions, 36 methods. Signatures extracted by static analysis of the actual source.
Repository: mkdocs/mkdocs
| Kind | Count |
|---|---|
| Classes | 38 |
| Functions | 29 |
| Methods | 36 |
API list
class
mkdocs.__main__.StateMaintain logging level.
func
mkdocs.__main__.build_command(clean, **kwargs)Build the MkDocs documentation.
func
mkdocs.__main__.cli()MkDocs - Project documentation with Markdown.
func
mkdocs.__main__.new_command(project_directory)Create a new MkDocs project.
func
mkdocs.__main__.serve_command(**kwargs)Run the builtin development server.
func
mkdocs.commands.build.build(config:MkDocsConfig, *serve_url:str | None=None, *dirty:bool=False) -> NonePerform a full site build.
func
mkdocs.commands.serve.serve(config_file:str | None=None, livereload:bool=True, build_type:str | None=None, watch_theme:bool=False, watch:list[str]=[], *open_in_browser:bool=False, **kwargs) -> NoneStart the MkDocs development server.
method
mkdocs.config.base.Config.load_dict(patch:dict) -> NoneLoad config options from a dictionary.
method
mkdocs.config.base.Config.load_file(config_file:IO) -> NoneLoad config options from the open file descriptor of a YAML file.
class
mkdocs.config.base.ValidationErrorRaised during the validation process of the config on errors.
func
mkdocs.config.base.load_config(config_file:str | IO | None=None, *config_file_path:str | None=None, **kwargs) -> MkDocsConfigLoad the configuration for a given file object or name.
class
mkdocs.config.config_options.ChoiceChoice Config Option.
class
mkdocs.config.config_options.DeprecatedDeprecated Config Option.
class
mkdocs.config.config_options.DictOfItemsValidates a dict of items.
class
mkdocs.config.config_options.DirDir Config Option.
class
mkdocs.config.config_options.ExtraScriptValueAn extra script to be added to the page.
class
mkdocs.config.config_options.FileFile Config Option.
class
mkdocs.config.config_options.FilesystemObjectBase class for options that point to filesystem objects.
class
mkdocs.config.config_options.IpAddressIpAddress Config Option.
class
mkdocs.config.config_options.ListOfItemsValidates a homogeneous list of items.
class
mkdocs.config.config_options.ListOfPathsList of Paths Config Option.
class
mkdocs.config.config_options.MarkdownExtensionsMarkdown Extensions Config Option.
class
mkdocs.config.config_options.NavNav Config Option.
class
mkdocs.config.config_options.OptionallyRequiredSoft-deprecated, do not use.
method
mkdocs.config.config_options.OptionallyRequired.validate(value)Perform some initial validation.
class
mkdocs.config.config_options.PathSpecA path pattern based on gitignore-like syntax.
class
mkdocs.config.config_options.PluginsPlugins config option.
class
mkdocs.config.config_options.PrivateA config option that can only be populated programmatically.
class
mkdocs.config.config_options.SiteDirSiteDir Config Option.
class
mkdocs.config.config_options.SubConfigSubconfig Config Option.
class
mkdocs.config.config_options.ThemeTheme Config Option.
class
mkdocs.config.config_options.TypeType Config Option.
class
mkdocs.config.config_options.URLURL Config Option.
func
mkdocs.config.defaults.get_schema() -> base.PlainConfigSchemaSoft-deprecated, do not use.
class
mkdocs.contrib.search.LangOptionValidate Language(s) provided in config are known languages.
class
mkdocs.contrib.search.SearchPluginAdd a search feature to MkDocs.
method
mkdocs.contrib.search.SearchPlugin.on_config(config:MkDocsConfig, **kwargs) -> MkDocsConfigAdd plugin templates and scripts to config.
method
mkdocs.contrib.search.SearchPlugin.on_page_context(context:TemplateContext, page:Page, **kwargs) -> NoneAdd page to search index.
method
mkdocs.contrib.search.SearchPlugin.on_post_build(config:MkDocsConfig, **kwargs) -> NoneBuild search index.
method
mkdocs.contrib.search.SearchPlugin.on_pre_build(config:MkDocsConfig, **kwargs) -> NoneCreate search index instance for later use.
class
mkdocs.exceptions.AbortAbort the build.
class
mkdocs.exceptions.BuildErrorThis error may be raised by MkDocs during the build process.
class
mkdocs.exceptions.MkDocsExceptionThe base class which all MkDocs exceptions inherit from.
class
mkdocs.plugins.BasePluginPlugin base class.
method
mkdocs.plugins.BasePlugin.load_config(options:dict[str, Any], config_file_path:str | None=None) -> tuple[ConfigErrors, ConfigWarnings]Load config from a dict of options.
method
mkdocs.plugins.BasePlugin.on_post_build(*config:MkDocsConfig) -> NoneThe `post_build` event does not alter any variables.
method
mkdocs.plugins.BasePlugin.on_pre_build(*config:MkDocsConfig) -> NoneThe `pre_build` event does not alter any variables.
class
mkdocs.plugins.PluginCollectionA collection of plugins.
class
mkdocs.plugins.PrefixedLoggerA logger adapter to prefix log messages.
method
mkdocs.plugins.PrefixedLogger.process(msg:str, kwargs:MutableMapping[str, Any]) -> tuple[str, Any]Process the message.
func
mkdocs.plugins.event_priority(priority:float) -> Callable[[T], T]A decorator to set an event priority for an event handler method.
func
mkdocs.plugins.get_plugin_logger(name:str) -> PrefixedLoggerReturn a logger for plugins.
class
mkdocs.structure.files.FileA MkDocs File object.
method
mkdocs.structure.files.File.abs_dest_path() -> strThe absolute concrete path of the destination file.
method
mkdocs.structure.files.File.abs_src_path() -> str | NoneThe absolute concrete path of the source file.
method
mkdocs.structure.files.File.content_bytes() -> bytesGet the content of this file as a bytestring.
method
mkdocs.structure.files.File.content_string() -> strGet the content of this file as a string.
method
mkdocs.structure.files.File.copy_file(dirty:bool=False) -> NoneCopy source file to destination, ensuring parent directories exist.
method
mkdocs.structure.files.File.is_css() -> boolReturn True if file is a CSS file.
method
mkdocs.structure.files.File.is_documentation_page() -> boolReturn True if file is a Markdown page.
method
mkdocs.structure.files.File.is_javascript() -> boolReturn True if file is a JavaScript file.
method
mkdocs.structure.files.File.is_media_file() -> boolReturn True if file is not a documentation or static page.
method
mkdocs.structure.files.File.is_static_page() -> boolReturn True if file is a static page (HTML, XML, JSON).
method
mkdocs.structure.files.File.url_relative_to(other:File | str) -> strReturn url for file relative to other file.
class
mkdocs.structure.files.FilesA collection of [File][mkdocs.structure.files.File] objects.
method
mkdocs.structure.files.Files.append(file:File) -> NoneAdd file to the Files collection.
method
mkdocs.structure.files.Files.copy_static_files(dirty:bool=False, *inclusion:Callable[[InclusionLevel], bool]=InclusionLevel.is_included) -> NoneCopy static files from source to destination.
method
mkdocs.structure.files.Files.css_files() -> Sequence[File]Return iterable of all CSS file objects.
method
mkdocs.structure.files.Files.documentation_pages(*inclusion:Callable[[InclusionLevel], bool]=InclusionLevel.is_included) -> Sequence[File]Return iterable of all Markdown page file objects.
method
mkdocs.structure.files.Files.get_file_from_path(path:str) -> File | NoneReturn a File instance with File.src_uri equal to path.
method
mkdocs.structure.files.Files.javascript_files() -> Sequence[File]Return iterable of all javascript file objects.
method
mkdocs.structure.files.Files.remove(file:File) -> NoneRemove file from Files collection.
method
mkdocs.structure.files.Files.src_paths() -> dict[str, File]Soft-deprecated, prefer `src_uris`.
method
mkdocs.structure.files.Files.static_pages() -> Sequence[File]Return iterable of all static page file objects.
func
mkdocs.structure.files.get_files(config:MkDocsConfig) -> FilesWalk the `docs_dir` and return a Files collection.
func
mkdocs.structure.nav.get_navigation(files:Files, config:MkDocsConfig) -> NavigationBuild site navigation from config and files.
method
mkdocs.structure.pages.Page.render(config:MkDocsConfig, files:Files) -> NoneConvert the Markdown source file to HTML as per the config.
method
mkdocs.structure.pages.Page.title() -> str | NoneReturns the title for the current page.
method
mkdocs.structure.pages.Page.url() -> strThe URL of the page relative to the MkDocs `site_dir`.
class
mkdocs.structure.toc.AnchorLinkA single entry in the table of contents.
method
mkdocs.structure.toc.AnchorLink.url() -> strThe hash fragment of a URL pointing to the item.
class
mkdocs.structure.toc.TableOfContentsRepresents the table of contents for a given page.
class
mkdocs.theme.ThemeA Theme object.
method
mkdocs.theme.Theme.get_env() -> jinja2.EnvironmentReturn a Jinja environment for the theme.
class
mkdocs.utils.CountHandlerCounts all logged messages >= level.
class
mkdocs.utils.DuplicateFilterAvoid logging duplicate messages.
func
mkdocs.utils.create_media_urls(path_list:Iterable[str], page:Page | None=None, base:str='') -> list[str]Soft-deprecated, do not use.
func
mkdocs.utils.dirname_to_title(dirname:str) -> strReturn a page tile obtained from a directory name.
func
mkdocs.utils.get_build_date() -> strReturns the displayable date string.
func
mkdocs.utils.get_build_datetime() -> datetimeReturns an aware datetime object.
func
mkdocs.utils.get_markdown_title(markdown_src:str) -> str | NoneSoft-deprecated, do not use.
func
mkdocs.utils.get_relative_url(url:str, other:str) -> strReturn given url relative to other.
func
mkdocs.utils.get_theme_dir(name:str) -> strReturn the directory of an installed theme by name.
func
mkdocs.utils.get_theme_names() -> Collection[str]Return a list of all installed themes by name.
func
mkdocs.utils.get_themes() -> dict[str, EntryPoint]Return a dict of all installed themes as {name: EntryPoint}.
func
mkdocs.utils.is_error_template(path:str) -> boolReturn True if the given file path is an HTTP error template.
func
mkdocs.utils.is_markdown_file(path:str) -> boolReturn True if the given file path is a Markdown file.
func
mkdocs.utils.meta.get_data(doc:str) -> tuple[str, dict[str, Any]]Extract meta-data from a text document.
func
mkdocs.utils.normalize_url(path:str, page:Page | None=None, base:str='') -> strReturn a URL relative to the given page or using the base.
func
mkdocs.utils.reduce_list(data_set:Iterable[T]) -> list[T]Reduce duplicate items in a list and preserve order.
func
mkdocs.utils.templates.script_tag_filter(context:TemplateContext, extra_script:ExtraScriptValue) -> strConverts an ExtraScript value to an HTML <script> tag line.
func
mkdocs.utils.templates.url_filter(context:TemplateContext, value:str) -> strA Template filter to normalize URLs.
func
mkdocs.utils.write_file(content:bytes, output_path:str) -> NoneWrite content to output_path, making sure any parent directories exist.
About this data
These signatures were extracted from the public source of mkdocs/mkdocs
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.