diff --git a/changelog/index.html b/changelog/index.html index 32cdc284..732022e7 100644 --- a/changelog/index.html +++ b/changelog/index.html @@ -1681,6 +1681,12 @@

Unreleased

Feature Add a pre-commit hook for pydoc-markdown.298@RomainTT + Improvement + +Bump minimum version of `databind.core` and `databind.json` to `^4.4.2` to ensure Python 3.12 support304@NiklasRosenstein + Breaking change + +Drop Python 3.7 compatibility304@NiklasRosenstein

4.8.2 (2023-06-26)

diff --git a/index.html b/index.html index c25ea155..24b9ee34 100644 --- a/index.html +++ b/index.html @@ -69,7 +69,7 @@
- + Skip to content @@ -1095,7 +1095,7 @@ -

Welcome to the Pydoc Markdown documentation! v4.8.2-2-ge878572 (develop)

+

Welcome to the Pydoc Markdown documentation! v4.8.2-3-g566847b (develop)

Python versions Pypi version

Pydoc-Markdown is a tool to create Python API documentation in Markdown format. Instead of executing your Python diff --git a/search/search_index.json b/search/search_index.json index cd396764..3db33397 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Welcome to the Pydoc Markdown documentation! v4.8.2-2-ge878572 (develop)","text":"

Pydoc-Markdown is a tool to create Python API documentation in Markdown format. Instead of executing your Python code like so many other documentation tools, it parses it using docspec instead.

\u2192 Go to the Documentation \ud83d\udcd8

Table of Contents

"},{"location":"#installation","title":"Installation \ud83d\udce6","text":"

You can install Pydoc-Markdown using Pipx:

$ pipx install pydoc-markdown\n

If you plan on using the Novella integration, you may want to install it as:

$ pipx install novella\n$ pipx inject novella pydoc-markdown[novella]\n

You need at least Python 3.7 to run Pydoc-Markdown. The Python version compatibility of the package you are looking to generate documentation for is irrelevant.

"},{"location":"#features","title":"Features \ud83c\udf1f","text":""},{"location":"#news","title":"News \ud83d\udce2","text":""},{"location":"#470-undeprecating-yaml-configuration","title":"4.7.0 (Undeprecating YAML configuration)","text":"

Many users prefer the YAML configuration over the using Novella, which is why starting with 4.7.0, the YAML style configuration is officially un-deprecated and will continue to be supported.

"},{"location":"#460-novella-integration","title":"4.6.0 (Novella integration)","text":"

Starting with 4.6.0, development focuses on integrating with Novella and use it as a replacement for tool-specific renderers thus far provided directly by Pydoc-Markdown (i.e. integrations with MkDocs, Hugo and Docusuraus). Such integrations are/will be provided by Novella instead.

With the Novella integration, you can now place generated API content in Markdown format inline with your existing Markdown documentation source files using @pydoc tags. Check out the Documentation for more information on how to use Pydoc-Markdown with Novella.

The old style of using Pydoc-Markdown with a YAML or PyProject configuration to generate files and kick off the build is now deprecated but will be maintained for the foreseeable future (at least until the next major version bump). It is strongly recommended to migrate your existing projects to using the Novella build backend.

"},{"location":"#contributing-to-pydoc-markdown","title":"Contributing to Pydoc-Markdown \ud83e\udd1d","text":"

All contributions are welcome! Check out the Contribution Guidelines.

"},{"location":"#questions-need-help","title":"Questions / Need help? \ud83e\udd14","text":"

Feel free to open a topic on GitHub Discussions!

"},{"location":"#projects-using-pydoc-markdown","title":"Projects using Pydoc-Markdown \ud83d\udcda","text":"

An incomplete list of projects that use Pydoc-Markdown to generate their API documentation. Feel free to open a pull request to add your project to this list!

"},{"location":"changelog/","title":"Changelog","text":""},{"location":"changelog/#unreleased","title":"Unreleased","text":"TypeDescriptionPRIssuesAuthor Feature Add a pre-commit hook for pydoc-markdown.298@RomainTT"},{"location":"changelog/#482-2023-06-26","title":"4.8.2 (2023-06-26)","text":"TypeDescriptionPRIssuesAuthor Fix Fix key aliases for `pre-render` and `post-render` keys in `Hooks` configuration295291@NiklasRosenstein"},{"location":"changelog/#481-2023-06-21","title":"4.8.1 (2023-06-21)","text":"TypeDescriptionPRIssuesAuthor Improvement Improve error message when no Pydoc Markdown configuration is found293@NiklasRosenstein Fix Upgrade to Databind `^4.4.0` which fixes the \"`ForwardRef` cannot be parameterized\" error.294292@NiklasRosenstein Fix Fix `NoMatchingConverter` for `TypeHint(typing.List[~T_Page])` by making the `Page` type a concrete subclass of the old `Page` class now called `GenericPage`. This is needed to correctly define a recursive type that Databind can de/serialize. The `Page` type stays backwards compatible at runtime for cases when it is used as a generic (e.g. `class MyPage(Page[MyPage]):`) to not break existing code.294291@NiklasRosenstein Tests Add unit tests to deserialize Mkdocs and Hugo example configuration.294@NiklasRosenstein"},{"location":"changelog/#480-2023-05-28","title":"4.8.0 (2023-05-28)","text":"TypeDescriptionPRIssuesAuthor Improvement Upgrade from Databind `^1.5.0` to ^4.3.0`. This should not have any impact on the average Pydoc-Markdown user, however there may be some changes necessary for users that have been using the Pydoc-Markdown API beacuse of the changes to Databind between v1 and v4. However, these users should have pinned the major version of databind they're relying on, so this change is not considered breaking for Pydoc-Markdown.289@NiklasRosenstein"},{"location":"changelog/#470-2023-05-28","title":"4.7.0 (2023-05-28)","text":"TypeDescriptionPRIssuesAuthor Improvement Change `PythonLoader.encoding` default value from `None` (system default) to `utf-8`282@NiklasRosenstein Improvement Support parsing all types of docstring formats that are supported by the `docstring_parser` module in `SphinxProcessor`, not just ReST282@hippalectryon-0 Fix No longer HTML-escape text in Markdown code blocks.282@hippalectryon-0 Fix Fix codeblocks rendering to maintain indentation as per the original docstring.283169@hippalectryon-0 Improvement Allow Pyyaml `^6.0` in addition to `^5.0`287@NiklasRosenstein Improvement Undeprecated YAML-based configuration for Pydoc-Markdown.288286@NiklasRosenstein Docs Update docs to inform user that `mkdocs` with `mkdocs-material` must be installed in Novella Usage guide.270@NiklasRosenstein"},{"location":"changelog/#464-2022-11-13","title":"4.6.4 (2022-11-13)","text":"TypeDescriptionPRIssuesAuthor Improvement add explicit compatibility with Novella 0.2.x (`>=0.1.10,<0.3.0`)@NiklasRosenstein Docs Fix installation instructions using Pipx (#256)256@NiklasRosenstein Fix fix interpreting Markdown in-document anchor links as cross references274@NiklasRosenstein Fix fix generated code for class signature with not base class and a metaclass parameter272@NiklasRosenstein"},{"location":"changelog/#463-2022-03-13","title":"4.6.3 (2022-03-13)","text":"TypeDescriptionPRIssuesAuthor Fix fix subscript error for type annotation in Python <=3.8@NiklasRosenstein"},{"location":"changelog/#462-2022-03-13","title":"4.6.2 (2022-03-13)","text":"TypeDescriptionPRIssuesAuthor Fix fix AttributeError when using a Git source linker with `use_branch` disabled252250@NiklasRosenstein Hygiene remove unused functions that interact with Git since the same functionality from the `nr.utils.git` module is used instead now252@NiklasRosenstein"},{"location":"changelog/#461-2022-03-05","title":"4.6.1 (2022-03-05)","text":"TypeDescriptionPRIssuesAuthor Fix fix recognition of overwritten values in `MarkdownRenderer.header_level_by_type`249248@NiklasRosenstein Fix fix backwards compat of handling `\"Data\"` key in `MarkdownRenderer.header_level_by_type` when now it should be `\"Variable\"`249@NiklasRosenstein"},{"location":"changelog/#460-2022-03-02","title":"4.6.0 (2022-03-02)","text":"TypeDescriptionPRIssuesAuthor Docs docusaurus: Update `plugin-content-docs` config for docusarus@beta to not exclude files and folders with underscores.235189@chrisstetter Hygiene remove `MarkdownRenderer.classdef_render_init_signature_if_needed` option because it never worked to begin with245@NiklasRosenstein Breaking change remove `MarkdownRenderer.render_to_stream()` from public api245@NiklasRosenstein Feature add `pydoc_markdown.interfaces.SingleObjectRenderer` and use it in Novella `@pydoc` tag processor245@NiklasRosenstein Feature add `ApiSuite` class and `ResolverV2` which is used by the new `@pydoc` tag preprocessor when using Novella245@NiklasRosenstein Feature `MarkdownReferenceResolver` now implements the new `ResolverV2` interface and can resolve references globally245@NiklasRosenstein Feature `CrossRefProcessor` now accepts a `resolver_v2` argument to use instead of the `resolver` object passed through the `Processor` API245@NiklasRosenstein Feature bring back formatting function, class and variable signatures with YAPF. (Tagging @lgeiger as the author because he was the original author of the feature in a previous version of Pydoc-Markdown, see https://github.com/NiklasRosenstein/pydoc-markdown/pull/78)245244@lgeiger Fix fix forwarding of `PluginBase.init()` calls to sub-plugins in unittests and `DocusaurusRenderer`245@NiklasRosenstein Improvement do not render link to source for modules in `MarkdownRenderer`245@NiklasRosenstein Improvement Git source linkers now fall back to the SHA if the current branch is invalid (e.g. in a detached HEAD state) and logs a warning@NiklasRosenstein"},{"location":"changelog/#451-2022-02-28","title":"4.5.1 (2022-02-28)","text":"TypeDescriptionPRIssuesAuthor Fix hugo: Hugo now respects the baseUrl option @Heiss@NiklasRosenstein Docs docusaurus: Update `plugin-content-docs` config for docusarus@beta to not exclude files and folders with underscores.189@chrisstetter Fix hugo: Adds Apple Silicon to Hugo's recognized architectures.@MilesCranmer Fix databind >1.4.0 changed Location.format()246@NiklasRosenstein"},{"location":"changelog/#450-2021-12-12","title":"4.5.0 (2021-12-12)","text":"TypeDescriptionPRIssuesAuthor Feature MarkdownRenderer: Add `render_page_title` option.214, 216@t6847kimo Feature git: Git source linkers now have a `use_branch` option to use the current branch name instead of the current commit SHA when generating links to the source code218@NiklasRosenstein"},{"location":"changelog/#440-2021-12-12","title":"4.4.0 (2021-12-12)","text":"TypeDescriptionPRIssuesAuthor Fix Sphinx processor now triggers when `:arg` or other Sphinx keywords are encountered in a docstring221@NiklasRosenstein Tests Refactor sphinx processor tests and add new test for param keyword only. Fixes minor issue with argument only docstring. @gmarks2149@NiklasRosenstein Fix sphinx_processor: Fix multi-line parameter sphinx docstring rendering issue by switching to docstring-parser to parse the docstrings. @gmarks2149195@NiklasRosenstein Fix Fix configuration generated with `--bootstrap mkdocs`230@gethvi Feature HugoRenderer: add `serverURL` and `serverPort` options to `$.renderer.config` block to allow overwriting the URL where the local Hugo server serves from202, 231@melMass Feature add `GitlabSourceLinker` class (entrypoint name: `gitlab`). @Heiss@NiklasRosenstein Feature MarkdownRenderer: add `render_typehint_in_data_header` option to `MarkdownRenderer`229@NiklasRosenstein Fix MarkdownRenderer: no longer escape markdown in headers when `html_headers` is enabled (used to result in additional backslashes when interpreted by most Markdown to HTML renderers)@NiklasRosenstein"},{"location":"changelog/#432-2021-09-04","title":"4.3.2 (2021-09-04)","text":"TypeDescriptionPRIssuesAuthor Fix minimum `click` version is `7.1`, allow also `8.x`@NiklasRosenstein"},{"location":"changelog/#431-2021-09-01","title":"4.3.1 (2021-09-01)","text":"TypeDescriptionPRIssuesAuthor Fix Calling pydoc-markdown with `--render-toc` option causes an exception213@NiklasRosenstein"},{"location":"changelog/#430-2021-08-28","title":"4.3.0 (2021-08-28)","text":"TypeDescriptionPRIssuesAuthor Fix fix use of `docspec.ApiObject.path` after we migrated away from using deprecated `docspec.ReverseMap`@NiklasRosenstein Improvement change default configuration of `MarkdownRenderer` (`signature_with_vertical_bar = False` (many people seemed to dislike that) and `signature_with_def = True` (for consistency with the included `class` keyword for classes))@NiklasRosenstein"},{"location":"changelog/#420-2021-08-20","title":"4.2.0 (2021-08-20)","text":"TypeDescriptionPRIssuesAuthor Fix HugoRenderer: Enable Hugo `markup.goldmark.renderer.unsafe` option by default198@NiklasRosenstein Fix MarkdownRenderer: Markdown renderer produces header anchors with `name` attribute instead of `id`200@NiklasRosenstein Feature MarkdownRenderer: @melMass added the `MarkdownRenderer.add_module_prefix` option199@NiklasRosenstein Docs switch Pydoc-Markdown to generated its docs with MkDocs@NiklasRosenstein Docs add Jinja2 renderer documentation in generated docs@NiklasRosenstein Improvement update template for `--bootstrap readthedocs` and related documentation@NiklasRosenstein Fix fix `mkdocs` bootstrap configuration, update mkdocs and hugo bootstrap config to include example on how to select parts of the API docs@NiklasRosenstein"},{"location":"changelog/#416-2021-08-09","title":"4.1.6 (2021-08-09)","text":"TypeDescriptionPRIssuesAuthor Fix HugoRenderer: Restore old behaviour for `HugoConfig.additional_options`, which should be deserialized flat (i.e. it takes on any additional options in the same object that can not be mapped to any other fields of the config object)@NiklasRosenstein"},{"location":"changelog/#415-2021-08-04","title":"4.1.5 (2021-08-04)","text":"TypeDescriptionPRIssuesAuthor Fix fix import from `databind.core`@NiklasRosenstein"},{"location":"changelog/#414-2021-08-04","title":"4.1.4 (2021-08-04)","text":"TypeDescriptionPRIssuesAuthor Fix remove unused dependency on `nr.collections`@NiklasRosenstein Improvement Use `tempfile` instead of `nr.fs`@NiklasRosenstein"},{"location":"changelog/#413-2021-07-24","title":"4.1.3 (2021-07-24)","text":"TypeDescriptionPRIssuesAuthor Fix MarkdownRenderer: Remove zombie line that triggers error when using the Markdown renderer directly196@NiklasRosenstein"},{"location":"changelog/#412-2021-07-23","title":"4.1.2 (2021-07-23)","text":"TypeDescriptionPRIssuesAuthor Fix fix `--render-toc` option@NiklasRosenstein Feature Jinja2Renderer: add `blockquote` and `describe` built-in filters@NiklasRosenstein"},{"location":"changelog/#411-2021-07-22","title":"4.1.1 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Improvement Jinja2Renderer: added `format_function_signature` filter@NiklasRosenstein"},{"location":"changelog/#410-2021-07-22","title":"4.1.0 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Fix CrossrefProcessor: missing trailing characters for unresolved crossref@NiklasRosenstein Improvement MarkdownRenderer: add MarkdownReferenceResolver helper class@NiklasRosenstein Feature Add `jinja2` renderer@NiklasRosenstein"},{"location":"changelog/#401-2021-07-22","title":"4.0.1 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Fix fix Python version classifiers@NiklasRosenstein"},{"location":"changelog/#400-2021-07-22","title":"4.0.0 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Breaking change Migrate to `databind.core 1.x` and `databind.json 1.x` from `nr.databind.core` and `nr.databin.json` and uses of `nr.interface` are replaced with ABCs. If you developed plugins for Pydoc-Markdown, please follow the guide at https://pydoc-markdown.readthedocs.io/en/latest/docs/migrate-from-3x-to-4x/. @NiklasRosenstein Fix docusaurus: Insert an additional newline after header anchors (``) when `MarkdownRenderer.insert_header_anchors` is enabled to fix Docusaurus header rendering. @NiklasRosenstein Fix unset `__PYENV_LAUNCHER__` environment variable for commands invoked via `$.hooks.pre-render` and `$.hooks.post-render` to avoid issues when the hook invokes a script installed into a different Python virtualenv than the virtualenv that is currently active in the terminal@NiklasRosenstein Improvement Pydoc-Markdown now requires Python 3.7 or newer (before it was 3.6 or newer). This is due to `databind.core` having that minimum version requirement@NiklasRosenstein"},{"location":"changelog/#3140-2021-07-19","title":"3.14.0 (2021-07-19)","text":"TypeDescriptionPRIssuesAuthor Feature add `MarkdownRenderer.signature_with_vertical_bar` option (contributed by @t6847kimo)192@NiklasRosenstein"},{"location":"changelog/#3130-2021-05-29","title":"3.13.0 (2021-05-29)","text":"TypeDescriptionPRIssuesAuthor Improvement upgrade to `docspec-python~0.2.0`@NiklasRosenstein"},{"location":"changelog/#3121-2021-05-21","title":"3.12.1 (2021-05-21)","text":"TypeDescriptionPRIssuesAuthor Fix add missing `dataclasses` dependency for Python 3.6 compatibility@NiklasRosenstein Fix set minimum Python version in `package.yml` to `^3.6`@NiklasRosenstein"},{"location":"changelog/#3120-2021-05-21","title":"3.12.0 (2021-05-21)","text":"TypeDescriptionPRIssuesAuthor Feature SphinxProcessor: parse `type` and `rtype`157@NiklasRosenstein"},{"location":"changelog/#3110-2021-05-20","title":"3.11.0 (2021-05-20)","text":"TypeDescriptionPRIssuesAuthor Feature Add support for getting configuration from pyproject.toml under the [tool.pydoc-markdown] table@NiklasRosenstein Fix fix docstring in PydocmdPreprocessor@NiklasRosenstein"},{"location":"changelog/#3103-2021-05-09","title":"3.10.3 (2021-05-09)","text":"TypeDescriptionPRIssuesAuthor Fix sort sidebar items in docusaurus183@NiklasRosenstein Fix replace backslashes with forward slashes in docusaurus sidebar (actually in 3.10.2)129@NiklasRosenstein"},{"location":"changelog/#3101-2021-04-02","title":"3.10.1 (2021-04-02)","text":"TypeDescriptionPRIssuesAuthor Fix fix code blocks indentation in `SphinxProcessor`179@NiklasRosenstein"},{"location":"changelog/#3100-2021-02-20","title":"3.10.0 (2021-02-20)","text":"TypeDescriptionPRIssuesAuthor Feature add `PythonLoader.encoding` option@NiklasRosenstein"},{"location":"changelog/#390-2020-12-15","title":"3.9.0 (2020-12-15)","text":"TypeDescriptionPRIssuesAuthor Fix Fix `IndexError` while processing short module path (by @g6123)167@NiklasRosenstein Improvement bump `watchdog` dependency to `^1.0.0`@NiklasRosenstein"},{"location":"changelog/#380-2020-11-06","title":"3.8.0 (2020-11-06)","text":"TypeDescriptionPRIssuesAuthor Feature add new `bitbucket` source linker (@hkenny, #163)@NiklasRosenstein"},{"location":"changelog/#370-2020-11-05","title":"3.7.0 (2020-11-05)","text":"TypeDescriptionPRIssuesAuthor Improvement FilterProcessor: Fix `NameError: name _check is not defined`, slightly alter behaviour of `FilterProcessor.expression` field`161@NiklasRosenstein"},{"location":"changelog/#361-2020-11-03","title":"3.6.1 (2020-11-03)","text":"TypeDescriptionPRIssuesAuthor Fix Fix using `data_code_block` option in `MarkdownRenderer`, and add a unit test for it160@NiklasRosenstein"},{"location":"changelog/#360-2020-10-28","title":"3.6.0 (2020-10-28)","text":"TypeDescriptionPRIssuesAuthor Feature Add `git` and `gitea` source linker (@tboulogne, #158)@NiklasRosenstein Improvement Update Docusaurus sidebar generation (@m-vdb, #156)@NiklasRosenstein"},{"location":"changelog/#350-2020-09-04","title":"3.5.0 (2020-09-04)","text":"TypeDescriptionPRIssuesAuthor Feature docusaurus: Add new `docusaurus` Renderer (contributed to by @m-vdb)151, 147@NiklasRosenstein Improvement markdown: Remove `MarkdownRenderer.fp` option, add `MarkdownRenderer.render_to_stream()`@NiklasRosenstein Feature filter: add `FilterProcessor.skip_empty_modules` option@NiklasRosenstein Feature markdown: Add `MarkdownRenderer.render_module_header_template` and `.escape_html_in_docstring` options@NiklasRosenstein Feature cli: Add `--bootstrap docusaurus` option@NiklasRosenstein"},{"location":"changelog/#340-2020-08-31","title":"3.4.0 (2020-08-31)","text":"TypeDescriptionPRIssuesAuthor Feature mkdocs: add `server_port` option, treat `MKDOCS_PORT` environment variable if `server_port` option is not set148@NiklasRosenstein"},{"location":"changelog/#331-2020-08-29","title":"3.3.1 (2020-08-29)","text":"TypeDescriptionPRIssuesAuthor Fix markdown: Fix \"list\" object has no attribute \"values\" in `MarkdownRenderer`149@NiklasRosenstein"},{"location":"changelog/#330-2020-07-17","title":"3.3.0 (2020-07-17)","text":"TypeDescriptionPRIssuesAuthor Feature plugin types can now be resolved by their FQN (i.e. the absolute import name, such as `pydoc_markdown.contrib.loaders.python.PythonLoader`) in addition to their registered entrypoint name.131@NiklasRosenstein Feature add new `SourceLinker` interface@NiklasRosenstein Feature add `GitHubSourceLinker` class (entrypoint name: `github`)@NiklasRosenstein Feature markdown: add `MarkdownRenderer.source_linker`, `.source_position` and `.source_format` options122@NiklasRosenstein Improvement cli: `-v,--verbose` and `-q,--quiet` flags are now countable (e.g. `-vv` will raise the logging verbosity to `DEBUG`)@NiklasRosenstein Improvement internal: Ensure consistency independent of the CWD from which Pydoc-Markdown is invoked as long as the same configuration file is used by introduce the `Context` object and the `init()` method for plugins. The `Context.directory` is set to the parent directory of the `pydoc-markdown.yml` configuration file. Plugins use that directory to interpret relative paths instead of the current working directory. @NiklasRosenstein Feature implement YTT-like YAML preprocessing when the Pydoc-Markdown configuration is loaded@NiklasRosenstein"},{"location":"changelog/#320post1-2020-07-15","title":"3.2.0.post1 (2020-07-15)","text":"TypeDescriptionPRIssuesAuthor Fix packaging: add `$.readme` to `pydoc-markdown/package.yaml`, fixing the generated `setup.py` to include the `README.md` from the parent folder.130@NiklasRosenstein"},{"location":"changelog/#320-2020-07-13","title":"3.2.0 (2020-07-13)","text":"TypeDescriptionPRIssuesAuthor Feature cli: add `--dump` and `--with-processors/--without-processors` options@NiklasRosenstein Docs add docstrings to classes defined in `pydoc_markdown.contrib.processors`@NiklasRosenstein Improvement use `docspec` module instead of `pydoc_markdown.reflection` to represent API objects@NiklasRosenstein Improvement python: use `docspec-python` to load Python API objects@NiklasRosenstein Improvement crossref: warnings produced about references that cannot be resolved are now summarized in a single log-line@NiklasRosenstein Improvement With the removal of `pydoc_markdown.reflection`, the `ModuleGraph` class has also been removed and replaced by List[docspec.Module]`@NiklasRosenstein Improvement filter: Rename FilterProcessor.include_root_objects to .do_not_filter_modules@NiklasRosenstein Improvement change type signatures and some method names of interfaces in `pydoc_markdown.interfaces`@NiklasRosenstein Improvement utils: The `Page.filtered_modules()` method now warns if an element in `Page.contents` did not match an API object@NiklasRosenstein Fix markdown: the Markdown header level for methods is now correctly read from the \"Method\" key in `MarkdownRenderer.header_level_by_type`121@NiklasRosenstein Improvement cli: remove `--bootstrap-mkdocs` in favor of `--bootstrap` option which now accepts an argument@NiklasRosenstein Improvement cli: the `--bootstrap` option now requires an argument, which must be either \"base\", \"mkdocs\" or \"hugo\" (new)@NiklasRosenstein Feature mkdocs: The `MkdocsRenderer.clean_render` option is enabled again by default, but instead of removing the whole `content_directory`, it will instead only remove files that it has previously generated (it will place a `.generated-files.txt` file in the `output_directory` for that).@NiklasRosenstein Feature cli: add `MarkdownRenderer.classdef_with_decorators` and `MarkdownRenderer.signature_with_decorators` options@NiklasRosenstein Feature Add new `HugoRenderer` (YAML type name `hugo`).106@NiklasRosenstein Feature smart-processor: now looks for a `@doc:fmt:` string in the docstring, which can be used to override the style that is used in case the automatically detected style is incorrect@NiklasRosenstein Docs The Pydoc-Markdown documentation is now available on Read the Docs (https://pydoc-markdown.readthedocs.io/en/latest/)@NiklasRosenstein Feature api: Add new `Builder` interface that is used with the new `--build` and `--site-dir` options@NiklasRosenstein Feature mkdocs: Implement `Builder` interface for `MkDocsRenderer`@NiklasRosenstein Feature hugo: Implement `Builder` interface for `HugoRenderer`@NiklasRosenstein Feature cli: Add new `--build` and `--site-dir` options as well as `--bootstrap readthedocs`@NiklasRosenstein Fix mkdocs: Fix error in MkDocs navigation generation if a page has no `source` and no `contents`@NiklasRosenstein Improvement mkdocs: generated `mkdocs.yml` now uses forward slashes for filenames on Windows system to increase portability129@NiklasRosenstein Feature add new `$.hooks.pre-render` and `$.hooks.post-render` options112@NiklasRosenstein"},{"location":"changelog/#311-2020-06-26","title":"3.1.1 (2020-06-26)","text":"TypeDescriptionPRIssuesAuthor Improvement dependencies: bump dependency on `nr.databind.core` to `~0.0.18` to avoid picking up the bad `0.0.17` version126@NiklasRosenstein"},{"location":"changelog/#310-2020-06-04","title":"3.1.0 (2020-06-04)","text":"TypeDescriptionPRIssuesAuthor Improvement cli: rename `--watch-and-serve` option to `--server`@NiklasRosenstein Improvement cli: watch and serve mainloop now reloads the config file and does not open the browser another time if it was already opened once.@NiklasRosenstein Fix cli: fix `pydoc-markdown.yml` generated with `--bootstrap`118@NiklasRosenstein Improvement markdown: * change default for `header_level_by_type` (`2` to `1` for modules, `3` to `2` for classes). * change default for `descriptive_class_title` (`false` to `true`) @NiklasRosenstein Feature markdown: added `content_directory` option (replaces hardcoded default `docs` value, defaults to `content` now)@NiklasRosenstein Improvement markdown: renamed `clean_docs_directory_on_render` to `clean_render` and change the default from `true` to `false`.@NiklasRosenstein Improvement mkdocs: `mkdocs_config` option can now be set to `null` (the renderer will the refrain from writing a `mkdocs.yml` file into the output directory). @NiklasRosenstein Fix python: fix assignments with annotations being ignored by the parser115@NiklasRosenstein"},{"location":"changelog/#302-2020-05-16","title":"3.0.2 (2020-05-16)","text":"TypeDescriptionPRIssuesAuthor Fix mkdocs: fix `NameError` in `MkdocsRenderer`@NiklasRosenstein"},{"location":"changelog/#301-2020-05-16","title":"3.0.1 (2020-05-16)","text":"TypeDescriptionPRIssuesAuthor Feature cli: added `--version` option@NiklasRosenstein Feature cli: added `-p,--package` option (which overrides `PythonLoader.packages`)@NiklasRosenstein Feature utils: added `pydoc_markdown.utils.page` module@NiklasRosenstein Feature cli: added `RenderSession` class to `pydoc_markdown.main` module which makes the cli logic easier to maintain and re-use.@NiklasRosenstein Feature markdown: added hidden `MarkdownRenderer.fp` option@NiklasRosenstein Feature python: added `PythonLoader.packages` option@NiklasRosenstein Improvement python: changed behavior of `PythonLoader.modules` option (it will not only load the module that was explicitly specified and exclude any sub-modules, if applicable).@NiklasRosenstein Improvement cli: dynamically lookup `MarkdownRenderer` configuration from the renderer to support renderers other than `MarkdownRenderer` and `MkdocsRenderer` that supply a `markdown` field that is an instance of `MarkdownRenderer` (so they can be used with `--render-toc` as well).@NiklasRosenstein"},{"location":"changelog/#300-2020-05-12","title":"3.0.0 (2020-05-12)","text":"TypeDescriptionPRIssuesAuthor Feature Initial release of Pydoc-Markdown v3.@NiklasRosenstein"},{"location":"contributing/","title":"Contributing to Pydoc-Markdown","text":"

Contributions to Pydoc-Markdown are very welcome!

If you want to talk about a potential contribution before investing any time, please do create a new topic on GitHub Discussions.

"},{"location":"contributing/#pull-request-requirements","title":"Pull request requirements","text":""},{"location":"contributing/#changelog-entries","title":"Changelog entries","text":"

Pydoc-Markdown uses Slam to manage changelogs. You should use the Slam CLI to add a new changelog entry, otherwise you need to manually generate a UUID-4.

$ slap changelog add -t <type> -d <changelog message> [--issue <issue_url>]\n

After you create the pull request, GitHub Actions will take care of injecting the PR URL into the changelog entry.

"},{"location":"api/cli/","title":"Command-line interface","text":"
Usage: pydoc-markdown [OPTIONS] [CONFIG]\n\n  Pydoc-Markdown is a renderer for Python API documentation in Markdown\n  format.\n\n  With no arguments it will load the default configuration file. If the\n  *config* argument is specified, it must be the name of a configuration file\n  or a YAML formatted object for the configuration.\n\nOptions:\n  --version                       Show the version and exit.\n  --bootstrap [base|mkdocs|hugo|readthedocs|docusaurus]\n                                  Create a Pydoc-Markdown configuration file\n                                  in the current working directory.\n  -v, --verbose                   Increase log verbosity.\n  -q, --quiet                     Decrease the log verbosity.\n  -m, --module MODULE             The module to parse and generated API\n                                  documentation for. Can be specified multiple\n                                  times. Using this option will disable\n                                  loading the default configuration file.\n  -p, --package PACKAGE           The package to parse and generated API\n                                  documentation for including all sub-packages\n                                  and -modules. Can be specified multiple\n                                  times. Using this option will disable\n                                  loading the default configuration file.\n  -I, --search-path PATH          A directory to use in the search for Python\n                                  modules. Can be specified multiple times.\n                                  Using this option will disable loading the\n                                  default configuration file.\n  --py2 / --py3                   Switch between parsing Python 2 and Python 3\n                                  code. The default is Python 3. Using --py2\n                                  will enable parsing code that uses the\n                                  \"print\" statement. This is equivalent of\n                                  setting the print_function option of the\n                                  \"python\" loader to False. Using this option\n                                  will disable loading the default\n                                  configuration file.\n  --render-toc / --no-render-toc  Enable/disable the rendering of the TOC in\n                                  the \"markdown\" renderer.\n  -s, --server                    Watch for file changes and re-render if\n                                  needed and start the server for the\n                                  configured renderer. This doesn't work for\n                                  all renderers.\n  -o, --open                      Open the browser after starting the server\n                                  with -s,--server.\n  --dump                          Dump the loaded modules in Docspec JSON\n                                  format to stdout, after the processors.\n  --with-processors / --without-processors\n                                  Enable/disable processors. Only with --dump.\n  --build                         Invoke a build after the Markdown files are\n                                  produced. Note that some renderers may not\n                                  support this option (e.g. the \"markdown\"\n                                  renderer).\n  --site-dir TEXT                 Set the output directory when using --build.\n  --help                          Show this message and exit.\n

Version: pydoc-markdown, version 4.8.2

"},{"location":"api/pydoc_markdown/","title":"Index","text":""},{"location":"api/pydoc_markdown/#class-pydocmarkdown","title":"Class PydocMarkdown","text":"
@dataclasses.dataclass\nclass PydocMarkdown()\n

[view_source]

This object represents the main configuration for Pydoc-Markdown.

"},{"location":"api/pydoc_markdown/#loaders","title":"loaders","text":"

A list of loader implementations that load docspec.Modules. Defaults to PythonLoader.

"},{"location":"api/pydoc_markdown/#processors","title":"processors","text":"

A list of processor implementations that modify docspec.Modules. Defaults to FilterProcessor, SmartProcessor and CrossrefProcessor.

"},{"location":"api/pydoc_markdown/#renderer","title":"renderer","text":"

A renderer for docspec.Modules. Defaults to MarkdownRenderer.

"},{"location":"api/pydoc_markdown/#hooks","title":"hooks","text":"

Hooks that can be executed at certain points in the pipeline. The commands are executed with the current SHELL.

"},{"location":"api/pydoc_markdown/#load_config","title":"load_config","text":"
def load_config(arg: t.Union[str, dict]) -> None\n

[view_source]

Loads the configuration from a nested data structure or filename as specified per the data

argument. If a filename is specified, it may be a JSON, YAML or TOML file. If the name of the TOML file is pyproject.yoml, the configuration will be read from the [tool.pydoc-markdown] section.

Arguments:

"},{"location":"api/pydoc_markdown/#init","title":"init","text":"
def init(context: Context) -> None\n

[view_source]

Initialize all plugins with the specified context. Cannot be called multiple times. If omitted, the plugins will be initialized with a default context before the load, process or render phase.

"},{"location":"api/pydoc_markdown/#load_modules","title":"load_modules","text":"
def load_modules() -> t.List[docspec.Module]\n

[view_source]

Loads modules via the loaders.

"},{"location":"api/pydoc_markdown/#process","title":"process","text":"
def process(modules: t.List[docspec.Module]) -> None\n

[view_source]

Process modules via the processors.

"},{"location":"api/pydoc_markdown/#render","title":"render","text":"
def render(modules: t.List[docspec.Module], run_hooks: bool = True) -> None\n

[view_source]

Render modules via the renderer.

"},{"location":"api/pydoc_markdown/interfaces/","title":"interfaces","text":"

This module defines the interfaces that can to be implemented for Pydoc-Markdown to implement custom loaders for documentation data, processors or renderers.

"},{"location":"api/pydoc_markdown/interfaces/#class-context","title":"Class Context","text":"
class Context()\n

[view_source]

Context data that is passed to plugins when they are loaded.

"},{"location":"api/pydoc_markdown/interfaces/#class-loader","title":"Class Loader","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.Loader\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass Loader(PluginBase)\n

[view_source]

This interface describes an object that is capable of loading documentation data. The location from which the documentation is loaded must be defined with the configuration class.

"},{"location":"api/pydoc_markdown/interfaces/#class-resolver","title":"Class Resolver","text":"
class Resolver(abc.ABC)\n

[view_source]

A resolver can be used by a Processor to replace cross references with a hyperlink.

"},{"location":"api/pydoc_markdown/interfaces/#class-resolverv2","title":"Class ResolverV2","text":"
class ResolverV2(abc.ABC)\n

[view_source]

New style interface for resolving based on a text ref from in the context of a docspec.ApiObject to find another. This is different from Resolver because it returns the resolved object directly, instead of some string representation of it.

"},{"location":"api/pydoc_markdown/interfaces/#class-processor","title":"Class Processor","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.Processor\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass Processor(PluginBase)\n

[view_source]

A processor is an object that takes a list of docspec.Modules as an input and transforms it in an arbitrary way. This usually processes docstrings to convert from various documentation syntaxes to plain Markdown.

"},{"location":"api/pydoc_markdown/interfaces/#class-renderer","title":"Class Renderer","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.Renderer\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass Renderer(PluginBase)\n

[view_source]

A renderer is an object that takes a list of docspec.Modules as an input and produces output files or writes to stdout. It may also expose additional command-line arguments. There can only be one renderer at the end of the processor chain.

Note that sometimes a renderer may need to perform some processing before the render step. To keep the possibility open that a renderer may implement generic processing that could used without the actual rendering functionality, Renderer is a subclass of Processor.

"},{"location":"api/pydoc_markdown/interfaces/#class-singlepagerenderer","title":"Class SinglePageRenderer","text":"
class SinglePageRenderer(PluginBase)\n

[view_source]

Interface for rendering a single page.

"},{"location":"api/pydoc_markdown/interfaces/#class-singleobjectrenderer","title":"Class SingleObjectRenderer","text":"
class SingleObjectRenderer(PluginBase)\n

[view_source]

Interface for rendering a single docspec.ApiObject.

"},{"location":"api/pydoc_markdown/interfaces/#class-server","title":"Class Server","text":"
class Server(abc.ABC)\n

[view_source]

This interface describes an object that can start a server process for live-viewing generated documentation in the browser. Renderer implementations may additionally implement this interface to advocate their compatibility with the --server and --open options of the pydoc-markdown CLI.

"},{"location":"api/pydoc_markdown/interfaces/#reload_server","title":"reload_server","text":"
def reload_server(process: subprocess.Popen) -> subprocess.Popen\n

[view_source]

Called when the files generated by pydoc-markdown have been updated. This gives the implementation a chance to reload the server process. The default implementation returns the process unchanged. Returning None will automatically call start_server() afterwards.

"},{"location":"api/pydoc_markdown/interfaces/#class-builder","title":"Class Builder","text":"
class Builder(abc.ABC)\n

[view_source]

This interface can be implemented additionally to the Renderer interface to indicate that the renderer supports building another produce after the markdown files have been rendered.

"},{"location":"api/pydoc_markdown/interfaces/#build","title":"build","text":"
@abc.abstractmethod\ndef build(site_dir: str) -> None\n

[view_source]

Invoke the build. The site_dir is the directory in which the output files should be placed. Otherwise, the directory may be determined by the builder.

"},{"location":"api/pydoc_markdown/interfaces/#class-sourcelinker","title":"Class SourceLinker","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.SourceLinker\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass SourceLinker(PluginBase)\n

[view_source]

This interface is used to determine the URL to the source of an API object. Renderers can use it to place a link to the source in the generated documentation.

"},{"location":"api/pydoc_markdown/loaders/","title":"pydoc_markdown.contrib.loaders.python","text":""},{"location":"api/pydoc_markdown/loaders/#class-pythonloader","title":"Class PythonLoader","text":"
@dataclasses.dataclass\nclass PythonLoader(Loader)\n

[view_source]

This implementation of the Loader interface parses Python modules and packages using docspec_python. See the options below to control which modules and packages are being loaded and how to configure the parser.

With no modules or packages set, the PythonLoader will discover available modules in the current and src/ directory.

lib2to3 Quirks

Pydoc-Markdown doesn't execute your Python code but instead relies on the lib2to3 parser. This means it also inherits any quirks of lib2to3.

List of known quirks

"},{"location":"api/pydoc_markdown/loaders/#packages","title":"packages","text":"

A list of package names that this loader will search for and then parse, including all sub-packages and modules.

"},{"location":"api/pydoc_markdown/loaders/#search_path","title":"search_path","text":"

The module search path. If not specified, the current sys.path is used instead. If any of the elements contain a * (star) symbol, it will be expanded with sys.path.

"},{"location":"api/pydoc_markdown/loaders/#ignore_when_discovered","title":"ignore_when_discovered","text":"

List of modules to ignore when using module discovery on the search_path.

"},{"location":"api/pydoc_markdown/loaders/#parser","title":"parser","text":"

Options for the Python parser.

"},{"location":"api/pydoc_markdown/loaders/#encoding","title":"encoding","text":"

The encoding to use when reading the Python source files.

Changed in 4.7.0: Default changed from None (system default encoding) to \"utf-8\".

"},{"location":"api/pydoc_markdown/processors/","title":"pydoc_markdown.contrib.processors","text":"

Module: pydoc_markdown.contrib.processors.crossref

"},{"location":"api/pydoc_markdown/processors/#class-crossrefprocessor","title":"Class CrossrefProcessor","text":"
@dataclasses.dataclass\nclass CrossrefProcessor(Processor)\n

[view_source]

Finds references to other objects in Markdown docstrings and produces links to other pages. The links are provided by the current Renderer via the Resolver interface.

Note: This processor is a work in progress, and most of the time it just converts references into inline-code.

The syntax for cross references is as follows:

This is a ref to another class: [PydocmdProcessor](#pydoc:pydoc_markdown.contrib.processors.pydocmd.PydocmdProcessor)\nYou can rename a ref like `this`~PydocmdProcessor\nAnd you can append to the ref name like this: [PydocmdProcessors](#pydoc:pydoc_markdown.contrib.processors.pydocmd.PydocmdProcessor)\n

Renders as

This is a ref to another class: PydocmdProcessor You can rename a ref like this~PydocmdProcessor And you can append to the ref name like this: PydocmdProcessors

Example configuration:

processors:\n  - type: crossref\n

"},{"location":"api/pydoc_markdown/processors/#resolver_v2","title":"resolver_v2","text":"

If specified, it will be used instead of the resolver passed to process() and the generated Markdown code for the reference uses Novella {@link } syntax.

Module: pydoc_markdown.contrib.processors.filter

"},{"location":"api/pydoc_markdown/processors/#class-filterprocessor","title":"Class FilterProcessor","text":"
@dataclasses.dataclass\nclass FilterProcessor(Processor)\n

[view_source]

The filter processor removes module and class members based on certain criteria.

Example configuration:

- type: filter\n  expression: not name.startswith('_') and default()\n  documented_only: false\n
"},{"location":"api/pydoc_markdown/processors/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/processors/#expression","title":"expression","text":"

A Python expression that is evaluated given the variables name, obj and default and is expected to return a boolean to indicate whether the docspec.ApiObject should be kept or removed. If specified, the expression is the ultimate truth for determining the keep-or-remove state of a node. Using 'default()' as the expression has the same semantic as not specifying this field. Default: null

"},{"location":"api/pydoc_markdown/processors/#documented_only","title":"documented_only","text":"

Keep only API objects that have docstrings. Default: true

"},{"location":"api/pydoc_markdown/processors/#exclude_private","title":"exclude_private","text":"

Exclude API objects that appear to be private members (i.e. their name begins with and underscore but does not end with one). Default: true

"},{"location":"api/pydoc_markdown/processors/#exclude_special","title":"exclude_special","text":"

Exclude special members (e.g.__path__, __annotations__, __name__ and __all__). Default: true

"},{"location":"api/pydoc_markdown/processors/#do_not_filter_modules","title":"do_not_filter_modules","text":"

Do not filter docspec.Module objects. Default: true

"},{"location":"api/pydoc_markdown/processors/#skip_empty_modules","title":"skip_empty_modules","text":"

Skip modules with no content. Default: false.

Module: pydoc_markdown.contrib.processors.google

"},{"location":"api/pydoc_markdown/processors/#class-googleprocessor","title":"Class GoogleProcessor","text":"
@dataclasses.dataclass\nclass GoogleProcessor(Processor)\n

[view_source]

This class implements the preprocessor for Google and PEP 257 docstrings. It converts docstrings formatted in the Google docstyle to Markdown syntax.

References:

Example:

Attributes:\n    module_level_variable1 (int): Module level variables may be documented in\n        either the ``Attributes`` section of the module docstring, or in an\n        inline docstring immediately following the variable.\n\n        Either form is acceptable, but the two should not be mixed. Choose\n        one convention to document module level variables and be consistent\n        with it.\n\nTodo:\n    * For module TODOs\n    * You have to also use ``sphinx.ext.todo`` extension\n

Renders as:

Attributes:

Either form is acceptable, but the two should not be mixed. Choose one convention to document module level variables and be consistent with it.

Todo:

Module: pydoc_markdown.contrib.processors.pydocmd

"},{"location":"api/pydoc_markdown/processors/#class-pydocmdprocessor","title":"Class PydocmdProcessor","text":"
@dataclasses.dataclass\nclass PydocmdProcessor(Processor)\n

[view_source]

The Pydoc-Markdown processor for Markdown docstrings. This processor parses docstrings formatted like the examples below and turns them into proper Markdown markup.

Examples:

# Arguments\n\narg1 (int): The first argument.\nkwargs (dict): Keyword arguments.\n\n# Raises\nRuntimeError: If something bad happens.\nValueError: If an invalid argument is specified.\n\n# Returns\nA value.\n

Renders as:

Arguments

Raises

Returns

A value.

Module: pydoc_markdown.contrib.processors.smart

"},{"location":"api/pydoc_markdown/processors/#class-smartprocessor","title":"Class SmartProcessor","text":"
@dataclasses.dataclass\nclass SmartProcessor(Processor)\n

[view_source]

This processor picks the GoogleProcessor, SphinxProcessor or PydocmdProcessor after guessing which is appropriate from the syntax it finds in the docstring.

Module: pydoc_markdown.contrib.processors.sphinx

"},{"location":"api/pydoc_markdown/processors/#class-sphinxprocessor","title":"Class SphinxProcessor","text":"
@dataclasses.dataclass\nclass SphinxProcessor(Processor)\n

[view_source]

This processor parses ReST/Sphinx-style function documentation and converts it into

Markdown syntax.

Example:

**Arguments**:\n\n- `arg1`: This is the first argument.\n- `arg1`: This is the first argument.\n\n**Raises**:\n\n- `ValueError`: If *arg1* is a bad value.\n- `ValueError`: If *arg1* is a bad value.\n\n**Returns**:\n\nAn `int` that represents an interesting value.\n

Renders as:

"},{"location":"api/pydoc_markdown/renderers/docusaurus/","title":"docusaurus","text":""},{"location":"api/pydoc_markdown/renderers/docusaurus/#class-customizedmarkdownrenderer","title":"Class CustomizedMarkdownRenderer","text":"
@dataclasses.dataclass\nclass CustomizedMarkdownRenderer(MarkdownRenderer)\n

[view_source]

We override some defaults in this subclass.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#insert_header_anchors","title":"insert_header_anchors","text":"

Disabled because Docusaurus supports this automatically.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#escape_html_in_docstring","title":"escape_html_in_docstring","text":"

Escape html in docstring, otherwise it could lead to invalid html.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#render_module_header_template","title":"render_module_header_template","text":"

Conforms to Docusaurus header format.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#class-docusaurusrenderer","title":"Class DocusaurusRenderer","text":"
@dataclasses.dataclass\nclass DocusaurusRenderer(Renderer)\n

[view_source]

Produces Markdown files and a sidebar.json file for use in a Docusaurus v2 websites. It creates files in a fixed layout that reflects the structure of the documented packages. The files will be rendered into the directory specified with the docs_base_path option.

Check out the complete Docusaurus example on GitHub.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/docusaurus/#markdown","title":"markdown","text":"

The MarkdownRenderer configuration.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#docs_base_path","title":"docs_base_path","text":"

The path where the docusaurus docs content is. Defaults \"docs\" folder.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#relative_output_path","title":"relative_output_path","text":"

The output path inside the docs_base_path folder, used to output the module reference.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#relative_sidebar_path","title":"relative_sidebar_path","text":"

The sidebar path inside the docs_base_path folder, used to output the sidebar for the module reference.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#sidebar_top_level_label","title":"sidebar_top_level_label","text":"

The top-level label in the sidebar. Default to 'Reference'. Can be set to null to remove the sidebar top-level all together. This option assumes that there is only one top-level module.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#sidebar_top_level_module_label","title":"sidebar_top_level_module_label","text":"

The top-level module label in the sidebar. Default to null, meaning that the actual module name will be used. This option assumes that there is only one top-level module.

"},{"location":"api/pydoc_markdown/renderers/hugo/","title":"hugo","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#class-hugopage","title":"Class HugoPage","text":"
@dataclasses.dataclass\nclass HugoPage(GenericPage[\"HugoPage\"])\n

[view_source]

A subclass of {@link pydoc:pydoc_markdown.util.pages.Page} which adds Hugo-specific overrides.

"},{"location":"api/pydoc_markdown/renderers/hugo/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#preamble","title":"preamble","text":"

The Hugo preamble of the page. This is merged with the HugoRenderer.default_preamble.

"},{"location":"api/pydoc_markdown/renderers/hugo/#directory","title":"directory","text":"

Override the directory that this page is rendered into (relative to the content directory). Defaults to null.

"},{"location":"api/pydoc_markdown/renderers/hugo/#class-hugoconfig","title":"Class HugoConfig","text":"
@dataclasses.dataclass\nclass HugoConfig()\n

[view_source]

Represents the Hugo configuration file that is rendered into the build directory.

"},{"location":"api/pydoc_markdown/renderers/hugo/#options_1","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#title","title":"title","text":"

Title of the site. This is a mandatory field.

"},{"location":"api/pydoc_markdown/renderers/hugo/#theme","title":"theme","text":"

The theme of the site. This is a mandatory field. It must be a string, a HugoThemePath or a HugoThemeGitUrl object. Examples:

theme: antarctica\ntheme: {clone_url: \"https://github.com/alex-shpak/hugo-book.git\"}\ntheme: docs/hugo-theme/\n

"},{"location":"api/pydoc_markdown/renderers/hugo/#baseurl","title":"baseURL","text":"

Base URL.

"},{"location":"api/pydoc_markdown/renderers/hugo/#serverurl","title":"serverURL","text":"

Server URL. Default: 127.0.0.1 aka localhost

"},{"location":"api/pydoc_markdown/renderers/hugo/#serverport","title":"serverPort","text":"

Server Port. Default: 1313

"},{"location":"api/pydoc_markdown/renderers/hugo/#languagecode","title":"languageCode","text":"

Language code. Default: en-us

"},{"location":"api/pydoc_markdown/renderers/hugo/#class-hugorenderer","title":"Class HugoRenderer","text":"
@dataclasses.dataclass\nclass HugoRenderer(Renderer, Server, Builder)\n

[view_source]

A renderer that produces Markdown files compatible with Hugo. The --bootstrap hugo option can be used to create a Pydoc-Markdown configuration file with the Hugo template.

Example configuration:

renderer:\n  type: hugo\n  config:\n    title: My Project\n    theme: {clone_url: \"https://github.com/alex-shpak/hugo-book.git\"}\n  # The \"book\" theme only renders pages in \"content/docs\" into the nav.\n  content_directory: content/docs\n  default_preamble: {menu: main}\n  pages:\n    - title: Home\n      name: index\n      source: README.md\n    - title: API Documentation\n      contents:\n        - '*'\n
"},{"location":"api/pydoc_markdown/renderers/hugo/#options_2","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#build_directory","title":"build_directory","text":"

The directory where all generated files are placed. Default: build/docs

"},{"location":"api/pydoc_markdown/renderers/hugo/#content_directory","title":"content_directory","text":"

The directory inside the build directory where the generated pages are written to. Default: content

"},{"location":"api/pydoc_markdown/renderers/hugo/#clean_render","title":"clean_render","text":"

Clean up files that were previously generated by the renderer before the next render pass. Defaults to True.

"},{"location":"api/pydoc_markdown/renderers/hugo/#pages","title":"pages","text":"

The pages to render.

"},{"location":"api/pydoc_markdown/renderers/hugo/#default_preamble","title":"default_preamble","text":"

The default Hugo preamble that is applied to every page. Example:

default_preamble:\n  menu: main\n

"},{"location":"api/pydoc_markdown/renderers/hugo/#markdown","title":"markdown","text":"

The MarkdownRenderer configuration.

"},{"location":"api/pydoc_markdown/renderers/hugo/#config","title":"config","text":"

The contents of the Hugo config.toml file as YAML. This can be set to null in order to not produce the config.toml file in the build_directory. Must be deserializable into a HugoConfig.

"},{"location":"api/pydoc_markdown/renderers/hugo/#get_hugo","title":"get_hugo","text":"

Options for when the Hugo binary is not present and should be downloaded automatically. Example:

get_hugo:\n  enabled: true\n  version: '0.71'\n  extended: true\n

"},{"location":"api/pydoc_markdown/renderers/hugo/#install_hugo","title":"install_hugo","text":"
def install_hugo(to: str,\n                 version: str | None = None,\n                 extended: bool = True) -> None\n

[view_source]

Downloads the latest release of Hugo from Github

and places it at the path specified by to. This will install the extended version if it is available and extended is set to True.

Arguments:

"},{"location":"api/pydoc_markdown/renderers/hugo/#get_github_releases","title":"get_github_releases","text":"
def get_github_releases(repo: str) -> t.Generator[dict, None, None]\n

[view_source]

Returns an iterator for all releases of a Github repository.

"},{"location":"api/pydoc_markdown/renderers/hugo/#parse_links_header","title":"parse_links_header","text":"
def parse_links_header(link_header: str) -> t.Dict[str, str]\n

[view_source]

Parses the Link HTTP header and returns a map of the links. Logic from PageLinks.java.

"},{"location":"api/pydoc_markdown/renderers/jinja2/","title":"jinja2","text":"

at any point on future Pydoc-Markdown versions.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#class-renderblock","title":"Class RenderBlock","text":"
@D.dataclass\nclass RenderBlock()\n

[view_source]

"},{"location":"api/pydoc_markdown/renderers/jinja2/#template","title":"template","text":"

The path to the Jinja2 template that is used to render the output files.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#produces","title":"produces","text":"

A mapping for filename (without suffix) to a list of Module selectors.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#jinja2_environment_settings","title":"jinja2_environment_settings","text":"

Settings for the Jinja2 Environment.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#class-jinja2renderer","title":"Class Jinja2Renderer","text":"
@D.dataclass\nclass Jinja2Renderer(Renderer)\n

[view_source]

"},{"location":"api/pydoc_markdown/renderers/jinja2/#renders","title":"renders","text":"

Render instructions.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#build_directory","title":"build_directory","text":"

Build directory where all the files are produced.

"},{"location":"api/pydoc_markdown/renderers/markdown/","title":"markdown","text":""},{"location":"api/pydoc_markdown/renderers/markdown/#class-markdownrenderer","title":"Class MarkdownRenderer","text":"
@dataclasses.dataclass\nclass MarkdownRenderer(Renderer, SinglePageRenderer, SingleObjectRenderer)\n

[view_source]

Produces Markdown files. This renderer is often used by other renderers, such as MkdocsRenderer and HugoRenderer. It provides a wide variety of options to customize the generated Markdown files.

"},{"location":"api/pydoc_markdown/renderers/markdown/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/markdown/#filename","title":"filename","text":"

The name of the file to render to. If no file is specified, it will render to stdout.

"},{"location":"api/pydoc_markdown/renderers/markdown/#encoding","title":"encoding","text":"

The encoding of the output file. This is ignored when rendering to stdout.

"},{"location":"api/pydoc_markdown/renderers/markdown/#insert_header_anchors","title":"insert_header_anchors","text":"

If enabled, inserts anchors before Markdown headers to ensure that links to the header work. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#html_headers","title":"html_headers","text":"

Generate HTML headers instead of Mearkdown headers. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#code_headers","title":"code_headers","text":"

Render names in headers as code (using backticks or <code> tags, depending on html_headers). This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#descriptive_class_title","title":"descriptive_class_title","text":"

Generate descriptive class titles by adding the word \"Objects\" if set to True. Otherwise, it can be a string that is appended or prepended (appended if the string begins with $). the class name. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#descriptive_module_title","title":"descriptive_module_title","text":"

Generate descriptivie module titles by adding the word \"Module\" before the module name. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_module_prefix","title":"add_module_prefix","text":"

Add the module name as a prefix to class & method names. This module name is also rendered as code if code_headers is enabled. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_method_class_prefix","title":"add_method_class_prefix","text":"

Add the class name as a prefix to method names. This class name is also rendered as code if code_headers is enabled. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_member_class_prefix","title":"add_member_class_prefix","text":"

Add the class name as a prefix to member names. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_full_prefix","title":"add_full_prefix","text":"

Add the full module name as a prefix to the title of the header. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#sub_prefix","title":"sub_prefix","text":"

If add_full_prefix is enabled, this will result in the prefix to be wrapped in a <sub> tag.

"},{"location":"api/pydoc_markdown/renderers/markdown/#data_code_block","title":"data_code_block","text":"

Render the definition of data members as a code block. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#data_expression_maxlength","title":"data_expression_maxlength","text":"

Max length of expressions. If this limit is exceeded, the remaining characters will be replaced with three dots. This is set to 100 by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#classdef_code_block","title":"classdef_code_block","text":"

Render the class signature as a code block. This includes the \"class\" keyword, the class name and its bases. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#classdef_with_decorators","title":"classdef_with_decorators","text":"

Render decorators before class definitions.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_python_help_style","title":"signature_python_help_style","text":"

Render classdef and function signature blocks in the Python help() style.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_code_block","title":"signature_code_block","text":"

Render the function signature as a code block. This includes the \"def\" keyword, the function name and its arguments. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_in_header","title":"signature_in_header","text":"

Render the function signature in the header. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_with_vertical_bar","title":"signature_with_vertical_bar","text":"

Render the vertical bar '|' before function signature. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_with_def","title":"signature_with_def","text":"

Include the \"def\" keyword in the function signature. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_class_prefix","title":"signature_class_prefix","text":"

Render the class name in the code block for function signature. Note that this results in invalid Python syntax to be rendered. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_with_decorators","title":"signature_with_decorators","text":"

Render decorators before function definitions.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_typehint_in_data_header","title":"render_typehint_in_data_header","text":"

Render type hints for data elements in the header.

"},{"location":"api/pydoc_markdown/renderers/markdown/#code_lang","title":"code_lang","text":"

Add the string \"python\" after the backticks for code blocks. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_page_title","title":"render_page_title","text":"

Render title of page at the beginning of the file.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_toc","title":"render_toc","text":"

Render a table of contents at the beginning of the file.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_toc_title","title":"render_toc_title","text":"

The title of the \"Table of Contents\" header.

"},{"location":"api/pydoc_markdown/renderers/markdown/#toc_maxdepth","title":"toc_maxdepth","text":"

The maximum depth of the table of contents. Defaults to 2.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_module_header","title":"render_module_header","text":"

Render module headers. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_module_header_template","title":"render_module_header_template","text":"

Custom template for module header.

"},{"location":"api/pydoc_markdown/renderers/markdown/#docstrings_as_blockquote","title":"docstrings_as_blockquote","text":"

Render docstrings as blockquotes. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#use_fixed_header_levels","title":"use_fixed_header_levels","text":"

Use a fixed header level for every kind of API object. The individual levels can be defined with header_level_by_type.

"},{"location":"api/pydoc_markdown/renderers/markdown/#header_level_by_type","title":"header_level_by_type","text":"

Fixed header levels by API object type.

"},{"location":"api/pydoc_markdown/renderers/markdown/#source_linker","title":"source_linker","text":"

A plugin that implements the SourceLinker interface to provide links to the source code of API objects. If this field is specified, the renderer will place links to the source code in the generated Markdown files.

"},{"location":"api/pydoc_markdown/renderers/markdown/#source_format","title":"source_format","text":"

Allows you to override how the \"view source\" link is rendered into the Markdown file if a source_linker is configured. The default is [[view_source]]({url}).

"},{"location":"api/pydoc_markdown/renderers/markdown/#escape_html_in_docstring","title":"escape_html_in_docstring","text":"

Escape html in docstring. Default to False.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_novella_anchors","title":"render_novella_anchors","text":"

Render Novella @anchor tags before headings.

"},{"location":"api/pydoc_markdown/renderers/markdown/#format_code","title":"format_code","text":"

Format code rendered into Markdown code blocks with YAPF.

"},{"location":"api/pydoc_markdown/renderers/markdown/#format_code_style","title":"format_code_style","text":"

The style to format code as. This can be a YAPF builtin style name or point to a file relative to the context directory (usually the working directory).

"},{"location":"api/pydoc_markdown/renderers/markdown/#get_resolver","title":"get_resolver","text":"
def get_resolver(modules: t.List[docspec.Module]) -> t.Optional[Resolver]\n

[view_source]

Returns a simple Resolver implementation. Finds cross-references in the same file.

"},{"location":"api/pydoc_markdown/renderers/markdown/#class-markdownreferenceresolver","title":"Class MarkdownReferenceResolver","text":"
@dataclasses.dataclass\nclass MarkdownReferenceResolver(Resolver, ResolverV2)\n

[view_source]

"},{"location":"api/pydoc_markdown/renderers/markdown/#resolve_reference","title":"resolve_reference","text":"
def resolve_reference(suite: ApiSuite, scope: docspec.ApiObject,\n                      ref: str) -> t.Optional[docspec.ApiObject]\n

[view_source]

Resolves the reference by searching in the members of scope or any of its parents.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/","title":"mkdocs","text":""},{"location":"api/pydoc_markdown/renderers/mkdocs/#class-customizedmarkdownrenderer","title":"Class CustomizedMarkdownRenderer","text":"
@dataclasses.dataclass\nclass CustomizedMarkdownRenderer(MarkdownRenderer)\n

[view_source]

We override some defaults in this subclass.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#class-mkdocsrenderer","title":"Class MkdocsRenderer","text":"
@dataclasses.dataclass\nclass MkdocsRenderer(Renderer, Server, Builder)\n

[view_source]

Produces Markdown files in a layout compatible with [MkDocs][0] and can be used with the Pydoc-Markdown --server option for a live-preview. The --bootstrap mkdocs option can be used to create a Pydoc-Markdown configuration file with the MkDocs template.

Example configuration:

renderer:\n  type: mkdocs\n  pages:\n    - title: Home\n      name: index\n      source: README.md\n    - title: API Documentation\n      contents:\n        - '*'\n  mkdocs_config:\n    site_name: My Project\n    theme: readthedocs\n
"},{"location":"api/pydoc_markdown/renderers/mkdocs/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/mkdocs/#output_directory","title":"output_directory","text":"

The output directory for the generated Markdown files. Defaults to build/docs.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#content_directory_name","title":"content_directory_name","text":"

Name of the content directory (inside the output_directory). Defaults to \"content\".

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#clean_render","title":"clean_render","text":"

Remove files generated in a previous pass by the Mkdocs renderer before rendering again. Defaults to True.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#markdown","title":"markdown","text":"

Markdown renderer settings.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#site_name","title":"site_name","text":"

The name of the site. This will be carried into the site_name key of the mkdocs_config.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#mkdocs_config","title":"mkdocs_config","text":"

Arbitrary configuration values that will be rendered to an mkdocs.yml file.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#server_port","title":"server_port","text":"

Port for the Mkdocs server when using the pydoc-markdown --server option. Defaults to 8000. Can be set with the MKDOCS_PORT environment variable:

$ MKDOCS_PORT=8383 pydoc-markdown -so\n
"},{"location":"examples/hugo/","title":"Hugo","text":""},{"location":"examples/hugo/#tips-tricks","title":"Tips & Tricks","text":""},{"location":"examples/hugo/#hugo-baseurl","title":"Hugo baseURL","text":"

When using Hugo, usually you want to set the baseURL configuration so that it can generated permalinks properly. If you are building on Read the Docs, chances are that you will have multiple versions of the documentation, which all require a different baseURL.

Pydoc-Markdown configuration files are pre-processed with a YTT-like templating language.

#@ def base_url():\n#@    if env.READTHEDOCS:\n#@      return \"https://pydoc-markdown.readthedocs.io/en/\" + env.READTHEDOCS_VERSION + \"/\"\n#@    else:\n#@      return None\n#@ end\n\nrenderer:\n  type: hugo\n  config:\n    baseURL: #@ base_url()\n
"},{"location":"examples/readthedocs/","title":"Read the Docs","text":"

Using Pydoc-Markdown on readthedocs.org requires some \"hacking\" because natively it does not allow you to run any custom commands. Using readthedocs-custom-steps, you can hook into the call that RTD expects to generate the documentation using Sphinx/MkDocs and run your own commands instead.

Example

.readthedocs.ymlsetup.cfgpyproject.toml
version: 2\nmkdocs: {}  # tell readthedocs to use mkdocs\npython:\n  version: 3.7\n  install:\n  - method: pip\n    extra_requirements:\n    - rtd\n
[options.extras_require]\nrtd = readthedocs-custom-steps==0.6.2\n
# ...\n\n[tool.readthedocs-custom-steps]\nscript = \"\"\"\nnovella --site-dir _site/html\n\"\"\"\n
"},{"location":"usage/cli-and-api/","title":"CLI and API","text":"

If you only want to use Pydoc-Markdown to generate Markdown from Python code, but not use it for anything else (such as interfacing with a static site generator), you can of course do that. You can make use of the Class PythonLoader and Class MarkdownRenderer, or more conveniently the Class PydocMarkdown APIs, or use the CLI.

"},{"location":"usage/cli-and-api/#cli-example","title":"CLI Example","text":"

The Pydoc-Markdown CLI accepts some options that can modify the default configuration (i.e. the Python loader and Markdown renderer) and write the generated Markdown to stdout.

pydoc-markdown -I src -m package_name.module_name --render-toc > module_name.md\n

You can also supply a YAML configuration as a positional argument that will be treated the same way as if it was loaded from a pydoc-markdown.yml file.

pydoc-markdown -m my_module '{\n    renderer: {\n      type: markdown,\n      descriptive_class_title: false,\n      render_toc: true\n    }\n  }' > my_module.md\n
"},{"location":"usage/cli-and-api/#api-example","title":"API Example","text":"Example 1Example 2
from pydoc_markdown.interfaces import Context\nfrom pydoc_markdown.contrib.loaders.python import PythonLoader\nfrom pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer\n\ncontext = Context(directory='.')\nloader = PythonLoader(search_path=['src'])\nrenderer = MarkdownRenderer(render_module_header=False)\n\nloader.init(context)\nrenderer.init(context)\n\nmodules = loader.load()\nprint(renderer.render_to_string(modules))\n

Note

This does not include any filtering logic and will just render every member in your Python code.

from pydoc_markdown import PydocMarkdown\nfrom pydoc_markdown.contrib.loaders.python import PythonLoader\nfrom pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer\n\nsession = PydocMarkdown()  # Preconfigured with a PythonLoader, FilterProcessor, CrossRefProcess, SmartProcessor and MarkdownRenderer\n\nassert isinstance(session.loaders[0], PythonLoader)\nsession.loaders[0].search_path = [\"src\"]\n\nassert isinstance(session.renderer, MarkdownRenderer)\nsession.renderer.render_to_string(session.process(session.load_modules()))\n
"},{"location":"usage/novella/","title":"Novella","text":""},{"location":"usage/novella/#getting-started","title":"Getting started","text":"

When using the Pydoc-Markdown integration with Novella to make use of its Markdown pre-processing capabilities, Pydoc-Markdown comes as a plugin that provides a @pydoc and @pylink tag to insert Markdown documentation generated by Pydoc-Markdown in the corresponding places of your documentation.

"},{"location":"usage/novella/#installation","title":"Installation","text":"

When using Pipx, the recommended installation method is to inject Pydoc-Markdown later:

$ pipx install novella\n$ pipx inject novella pydoc-markdown[novella]\n

If you manage the environment yourself, it's sufficient to install Pydoc-Markdown with the novella extra.

$ pip install pydoc-markdown[novella]\n
"},{"location":"usage/novella/#configuration","title":"Configuration","text":"

A Novella build is configured using a build.novella script. In most cases you want to rely on a template provided by Novella, such as the MkDocs template. Check out the Novella documentation to find what types of templates are available here.

docs/build.novella
template \"mkdocs\" {\n  content_directory = \"content\"\n}\n\naction \"preprocess-markdown\" {\n  use \"pydoc\"\n}\n

What is happening here?

  1. The mkdocs pipeline template is applied. The content_directory is the directory that contains your MkDocs source files. It will be copied to the temporary build location alongside the mkdocs.yml file. Note that your build.novella script should sit next two these files.

Note: You should have mkdocs on your PATH and it should have the mkdocs-material theme installed (the default theme that Novella will apply if you don't specify a different one in your mkdocs.yml file or in build.novella).

  1. The preprocess-markdown action that is one of the actions created by the template is retrieved and configured further. We instruct it to make use of the \"pydoc\" plugin, which is implemented by Pydoc-Markdown and provides the @pydoc and {@link pydoc:} tags.

Note

"},{"location":"usage/novella/#using-novella-tags","title":"Using Novella tags","text":"

For example, the @cat tag is useful to inject the content of another file.

docs/content/index.md
# Welcome to my Project documentation!\n\n@cat ../../readme.md :with slice_lines = \"2:\"\n

The @pydoc tag is the piece provided by Pydoc-Markdown itself. It uses the Class MarkdownRenderer to generate Markdown formatted API documentation of the API object you specify.

docs/content/api.md
# API Documentation\n\n@pydoc my_module.SomeClass\n
"},{"location":"usage/novella/#build-the-documentation","title":"Build the documentation","text":"

Change into the docs/ directory where your build.novella script resides and invoke the Novella CLI. The MkDocs template exposes some command-line arguments that you can pass through the CLI, one of which is the --serve option that runs MkDocs in the server mode instead of building the documentation and writing it to disk.

$ novella --help
usage: novella [--version] [-h] [-i TEMPLATE] [-c PATH] [-d DIRECTORY]\n               [-b PATH] [-r] [--dot] [--intercept ACTION] [--serve]\n               [--port PORT] [--site-dir PATH] [--base-url URL]\n\noptions:\n  --version             show program's version number and exit\n  -h, --help            Show this help output.\n  -i TEMPLATE, --init TEMPLATE\n                        Create a `build.novella` file initialized from a\n                        template. Available templates are: \"mkdocs\", \"hugo\"\n  -c PATH, --config-file PATH\n                        The configuration file to load. Can be a\n                        pyproject.toml in which case the code is looked up\n                        under the tool.novella.script key. (default: None)\n  -d DIRECTORY, --directory DIRECTORY\n                        Switch to the specified directory before executing the\n                        configuration file.\n  -b PATH, --build-directory PATH\n                        The build directory. If not specified, a temporary\n                        directory will be created.\n  -r, --use-reloader    Enable reloading, which will re-execute the pipeline\n                        if a watched file changes.\n  --dot                 Produce a DotViz representation of the build graph.\n  --intercept ACTION    The name of an action to intercept and pause the\n                        execution, waiting for user input to continue. Useful\n                        for debugging intermediate steps of the build process.\n                        Currently, the action name must be matched exactly and\n                        actions can only be intercepted before they are run.\n                        If this option is provided, all possible intercept\n                        points are logged to the console.\n\ntemplate (mkdocs):\n  --serve               Use mkdocs serve\n  --port PORT           The port to serve under\n  --site-dir PATH       Build directory for MkDocs (defaults to \"_site\")\n  --base-url URL        The base URL to prefix to autogenerated link inside\n                        the documentation.\n
"},{"location":"usage/novella/#advantages-over-the-yaml-configuration","title":"Advantages over the YAML Configuration","text":"

The YAML Configuration allows you to define in one file all pages and the Python API objects they should contain. However, when you use Novella, each page will need to exist as a Markdown file. This has a few advantages:

Now, if you still want to generate Markdown files at build time, Pydoc-Markdown does not currently provide any functionality to do that; although some discussion around the topic is happening in #245. However, the Novella build script is just code, so if you really need it, you can generate the files there:

docs/build.novella
template \"mkdocs\"\n\ndef api_pages = {\n  \"SomeClass\": \"my_module.SomeClass\",\n  # ...\n}\n\naction \"mkdocs-update-config\" {\n  site_name = \"My module\"\n  profile = \"readthedocs\"\n  update_with config -> {\n    def items = []\n    for title, package in api_pages.items():\n      items.append({ title: 'api/{}.md'.format(package) })\n    config['nav'].append({ 'API Documentation': items })\n  }\n}\n\naction \"preprocess-markdown\" {\n  use \"pydoc\"\n}\n\ndo\n  name: \"generate-api-pages\"\n  closure: {\n    # Make sure that this action runs before the Markdown preprocessors.\n    precedes \"preprocess-markdown\"\n  }\n  action: {\n    for title, package in api_pages.items():\n      def path = directory / 'content' / 'api' / (package + '.md')\n      path.parent.mkdir(parents=True, exist_ok=True)\n      path.write_text('---\\ntitle: {}\\n---\\n@pydoc {}\\n'.format(title, package))\n  }\n
"},{"location":"usage/yaml/","title":"YAML Configuration","text":""},{"location":"usage/yaml/#yaml-configuration","title":"YAML Configuration","text":"

Pydoc-Markdown can be configured with using via a YAML file. By default, the CLI will look for a file called pydoc-markdown.yaml (or .yml) in the current working directory. (Note that the configuration is not read from file when using the -m,--module, -p,--package and other options that are intended for invoking Pydoc-Markdown without a configuration file).

Tip: The --bootstrap and --bootstrap-mkdocs options can be used to write a template configuration file.

If you use the YAML configuration, the configuration file is pre-processed with a YTT-like templating language (see YAML Preprocessing).

The configuration contains of four main sections:

"},{"location":"usage/yaml/#yaml-example","title":"YAML Example","text":"
loaders:\n- type: python\n  search_path: [../src]\nrenderer:\n  type: mkdocs\n  pages:\n  - title: API Documentation\n    name: index\n    contents:\n    - school.*\n
"},{"location":"usage/yaml/#pyproject-example","title":"PyProject Example","text":"
[[tool.pydoc-markdown.loaders]]\ntype = \"python\"\nsearch_path = [ \"../src\" ]\n\n[tool.pydoc-markdown.renderer]\ntype = \"mkdocs\"\n\n[[tool.pydoc-markdown.renderer.pages]]\ntitle = \"API Documentation\"\nname = \"index\"\ncontents = [ \"school.*\" ]\n
"},{"location":"usage/yaml/#yaml-preprocessing","title":"YAML Preprocessing","text":"

New in Pydoc-Markdown 3.3.0. See also pydoc_markdown.util.ytemplate

Pydoc-Markdown performs very basic pre-processing on the YAML configuration before it is deserialized. The format is similar to that of YTT, but supports only a subset of the features and logic is interpreted as actual Python code.

Supports preprocessing features:

Check out the Read the Docs/Hugo baseURL documentation for an example.

"},{"location":"usage/yaml/#loaders","title":"Loaders","text":"

Loaders are configured in the $.loaders section of the Pydoc-Markdown configuration file. The key must be a list of loader definitions. Currently there is only the Python Loader.

Example:

loaders:\n- type: loadertype1\n  key: value\n- type: loadertype2\n

If no loaders are specified, the Python loader is used by default.

"},{"location":"usage/yaml/#processors","title":"Processors","text":"

Similar to the Loaders, the $.processors section expects a list of processor definitions. If no processors are defined, the filter, smart and crossref processors are used (in that order). Many processors do not have any additional options.

Example:

processors:\n- type: filter\n  documented_only: false\n- type: smart\n- type: crossref\n
"},{"location":"usage/yaml/#renderer","title":"Renderer","text":"

The $.renderer defines the renderer to use when running pydoc-markdown without arguments. Some renderers support the --server option, which allows a live-preview of the documentation. The default renderer is the Markdown renderer which will print the result to the terminal.

Other renderers may produce files on disk in a layout that conforms with the static site generator that they aim to support.

Example:

renderer:\n  type: mkdocs\n  pages:\n  - title: API Documentation\n    name: index\n    contents:\n    - school.*\n
"},{"location":"usage/yaml/#hooks","title":"Hooks","text":"

Example:

hooks:\n  pre-render:\n  - generate-changelog >docs/CHANGELOG.md\n

Allows you to specify shell commands that will be execute before or after the render step.

Available keys

"},{"location":"usage/yaml/#testing-your-configuration","title":"Testing your Configuration","text":"

You can test the configuration of your loaders using the pydoc-markdown --dump option. Combine this with docpspec -m --dump-tree to get a full formatted list tree of all API objects that Pydoc-Markdown has discovered, after applying all processors. You can disable processors by adding the --without-processors function.

$ pydoc-markdown --dump | docspec -m --dump-tree\nmodule school._class\n| class Class\n| | data topic\n| | data teacher\nmodule school._person\n| class Person\n| | data name\n| | data age\nmodule school._pupil\n| class Pupil\n[ ... ]\n
"}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Welcome to the Pydoc Markdown documentation! v4.8.2-3-g566847b (develop)","text":"

Pydoc-Markdown is a tool to create Python API documentation in Markdown format. Instead of executing your Python code like so many other documentation tools, it parses it using docspec instead.

\u2192 Go to the Documentation \ud83d\udcd8

Table of Contents

"},{"location":"#installation","title":"Installation \ud83d\udce6","text":"

You can install Pydoc-Markdown using Pipx:

$ pipx install pydoc-markdown\n

If you plan on using the Novella integration, you may want to install it as:

$ pipx install novella\n$ pipx inject novella pydoc-markdown[novella]\n

You need at least Python 3.7 to run Pydoc-Markdown. The Python version compatibility of the package you are looking to generate documentation for is irrelevant.

"},{"location":"#features","title":"Features \ud83c\udf1f","text":""},{"location":"#news","title":"News \ud83d\udce2","text":""},{"location":"#470-undeprecating-yaml-configuration","title":"4.7.0 (Undeprecating YAML configuration)","text":"

Many users prefer the YAML configuration over the using Novella, which is why starting with 4.7.0, the YAML style configuration is officially un-deprecated and will continue to be supported.

"},{"location":"#460-novella-integration","title":"4.6.0 (Novella integration)","text":"

Starting with 4.6.0, development focuses on integrating with Novella and use it as a replacement for tool-specific renderers thus far provided directly by Pydoc-Markdown (i.e. integrations with MkDocs, Hugo and Docusuraus). Such integrations are/will be provided by Novella instead.

With the Novella integration, you can now place generated API content in Markdown format inline with your existing Markdown documentation source files using @pydoc tags. Check out the Documentation for more information on how to use Pydoc-Markdown with Novella.

The old style of using Pydoc-Markdown with a YAML or PyProject configuration to generate files and kick off the build is now deprecated but will be maintained for the foreseeable future (at least until the next major version bump). It is strongly recommended to migrate your existing projects to using the Novella build backend.

"},{"location":"#contributing-to-pydoc-markdown","title":"Contributing to Pydoc-Markdown \ud83e\udd1d","text":"

All contributions are welcome! Check out the Contribution Guidelines.

"},{"location":"#questions-need-help","title":"Questions / Need help? \ud83e\udd14","text":"

Feel free to open a topic on GitHub Discussions!

"},{"location":"#projects-using-pydoc-markdown","title":"Projects using Pydoc-Markdown \ud83d\udcda","text":"

An incomplete list of projects that use Pydoc-Markdown to generate their API documentation. Feel free to open a pull request to add your project to this list!

"},{"location":"changelog/","title":"Changelog","text":""},{"location":"changelog/#unreleased","title":"Unreleased","text":"TypeDescriptionPRIssuesAuthor Feature Add a pre-commit hook for pydoc-markdown.298@RomainTT Improvement Bump minimum version of `databind.core` and `databind.json` to `^4.4.2` to ensure Python 3.12 support304@NiklasRosenstein Breaking change Drop Python 3.7 compatibility304@NiklasRosenstein"},{"location":"changelog/#482-2023-06-26","title":"4.8.2 (2023-06-26)","text":"TypeDescriptionPRIssuesAuthor Fix Fix key aliases for `pre-render` and `post-render` keys in `Hooks` configuration295291@NiklasRosenstein"},{"location":"changelog/#481-2023-06-21","title":"4.8.1 (2023-06-21)","text":"TypeDescriptionPRIssuesAuthor Improvement Improve error message when no Pydoc Markdown configuration is found293@NiklasRosenstein Fix Upgrade to Databind `^4.4.0` which fixes the \"`ForwardRef` cannot be parameterized\" error.294292@NiklasRosenstein Fix Fix `NoMatchingConverter` for `TypeHint(typing.List[~T_Page])` by making the `Page` type a concrete subclass of the old `Page` class now called `GenericPage`. This is needed to correctly define a recursive type that Databind can de/serialize. The `Page` type stays backwards compatible at runtime for cases when it is used as a generic (e.g. `class MyPage(Page[MyPage]):`) to not break existing code.294291@NiklasRosenstein Tests Add unit tests to deserialize Mkdocs and Hugo example configuration.294@NiklasRosenstein"},{"location":"changelog/#480-2023-05-28","title":"4.8.0 (2023-05-28)","text":"TypeDescriptionPRIssuesAuthor Improvement Upgrade from Databind `^1.5.0` to ^4.3.0`. This should not have any impact on the average Pydoc-Markdown user, however there may be some changes necessary for users that have been using the Pydoc-Markdown API beacuse of the changes to Databind between v1 and v4. However, these users should have pinned the major version of databind they're relying on, so this change is not considered breaking for Pydoc-Markdown.289@NiklasRosenstein"},{"location":"changelog/#470-2023-05-28","title":"4.7.0 (2023-05-28)","text":"TypeDescriptionPRIssuesAuthor Improvement Change `PythonLoader.encoding` default value from `None` (system default) to `utf-8`282@NiklasRosenstein Improvement Support parsing all types of docstring formats that are supported by the `docstring_parser` module in `SphinxProcessor`, not just ReST282@hippalectryon-0 Fix No longer HTML-escape text in Markdown code blocks.282@hippalectryon-0 Fix Fix codeblocks rendering to maintain indentation as per the original docstring.283169@hippalectryon-0 Improvement Allow Pyyaml `^6.0` in addition to `^5.0`287@NiklasRosenstein Improvement Undeprecated YAML-based configuration for Pydoc-Markdown.288286@NiklasRosenstein Docs Update docs to inform user that `mkdocs` with `mkdocs-material` must be installed in Novella Usage guide.270@NiklasRosenstein"},{"location":"changelog/#464-2022-11-13","title":"4.6.4 (2022-11-13)","text":"TypeDescriptionPRIssuesAuthor Improvement add explicit compatibility with Novella 0.2.x (`>=0.1.10,<0.3.0`)@NiklasRosenstein Docs Fix installation instructions using Pipx (#256)256@NiklasRosenstein Fix fix interpreting Markdown in-document anchor links as cross references274@NiklasRosenstein Fix fix generated code for class signature with not base class and a metaclass parameter272@NiklasRosenstein"},{"location":"changelog/#463-2022-03-13","title":"4.6.3 (2022-03-13)","text":"TypeDescriptionPRIssuesAuthor Fix fix subscript error for type annotation in Python <=3.8@NiklasRosenstein"},{"location":"changelog/#462-2022-03-13","title":"4.6.2 (2022-03-13)","text":"TypeDescriptionPRIssuesAuthor Fix fix AttributeError when using a Git source linker with `use_branch` disabled252250@NiklasRosenstein Hygiene remove unused functions that interact with Git since the same functionality from the `nr.utils.git` module is used instead now252@NiklasRosenstein"},{"location":"changelog/#461-2022-03-05","title":"4.6.1 (2022-03-05)","text":"TypeDescriptionPRIssuesAuthor Fix fix recognition of overwritten values in `MarkdownRenderer.header_level_by_type`249248@NiklasRosenstein Fix fix backwards compat of handling `\"Data\"` key in `MarkdownRenderer.header_level_by_type` when now it should be `\"Variable\"`249@NiklasRosenstein"},{"location":"changelog/#460-2022-03-02","title":"4.6.0 (2022-03-02)","text":"TypeDescriptionPRIssuesAuthor Docs docusaurus: Update `plugin-content-docs` config for docusarus@beta to not exclude files and folders with underscores.235189@chrisstetter Hygiene remove `MarkdownRenderer.classdef_render_init_signature_if_needed` option because it never worked to begin with245@NiklasRosenstein Breaking change remove `MarkdownRenderer.render_to_stream()` from public api245@NiklasRosenstein Feature add `pydoc_markdown.interfaces.SingleObjectRenderer` and use it in Novella `@pydoc` tag processor245@NiklasRosenstein Feature add `ApiSuite` class and `ResolverV2` which is used by the new `@pydoc` tag preprocessor when using Novella245@NiklasRosenstein Feature `MarkdownReferenceResolver` now implements the new `ResolverV2` interface and can resolve references globally245@NiklasRosenstein Feature `CrossRefProcessor` now accepts a `resolver_v2` argument to use instead of the `resolver` object passed through the `Processor` API245@NiklasRosenstein Feature bring back formatting function, class and variable signatures with YAPF. (Tagging @lgeiger as the author because he was the original author of the feature in a previous version of Pydoc-Markdown, see https://github.com/NiklasRosenstein/pydoc-markdown/pull/78)245244@lgeiger Fix fix forwarding of `PluginBase.init()` calls to sub-plugins in unittests and `DocusaurusRenderer`245@NiklasRosenstein Improvement do not render link to source for modules in `MarkdownRenderer`245@NiklasRosenstein Improvement Git source linkers now fall back to the SHA if the current branch is invalid (e.g. in a detached HEAD state) and logs a warning@NiklasRosenstein"},{"location":"changelog/#451-2022-02-28","title":"4.5.1 (2022-02-28)","text":"TypeDescriptionPRIssuesAuthor Fix hugo: Hugo now respects the baseUrl option @Heiss@NiklasRosenstein Docs docusaurus: Update `plugin-content-docs` config for docusarus@beta to not exclude files and folders with underscores.189@chrisstetter Fix hugo: Adds Apple Silicon to Hugo's recognized architectures.@MilesCranmer Fix databind >1.4.0 changed Location.format()246@NiklasRosenstein"},{"location":"changelog/#450-2021-12-12","title":"4.5.0 (2021-12-12)","text":"TypeDescriptionPRIssuesAuthor Feature MarkdownRenderer: Add `render_page_title` option.214, 216@t6847kimo Feature git: Git source linkers now have a `use_branch` option to use the current branch name instead of the current commit SHA when generating links to the source code218@NiklasRosenstein"},{"location":"changelog/#440-2021-12-12","title":"4.4.0 (2021-12-12)","text":"TypeDescriptionPRIssuesAuthor Fix Sphinx processor now triggers when `:arg` or other Sphinx keywords are encountered in a docstring221@NiklasRosenstein Tests Refactor sphinx processor tests and add new test for param keyword only. Fixes minor issue with argument only docstring. @gmarks2149@NiklasRosenstein Fix sphinx_processor: Fix multi-line parameter sphinx docstring rendering issue by switching to docstring-parser to parse the docstrings. @gmarks2149195@NiklasRosenstein Fix Fix configuration generated with `--bootstrap mkdocs`230@gethvi Feature HugoRenderer: add `serverURL` and `serverPort` options to `$.renderer.config` block to allow overwriting the URL where the local Hugo server serves from202, 231@melMass Feature add `GitlabSourceLinker` class (entrypoint name: `gitlab`). @Heiss@NiklasRosenstein Feature MarkdownRenderer: add `render_typehint_in_data_header` option to `MarkdownRenderer`229@NiklasRosenstein Fix MarkdownRenderer: no longer escape markdown in headers when `html_headers` is enabled (used to result in additional backslashes when interpreted by most Markdown to HTML renderers)@NiklasRosenstein"},{"location":"changelog/#432-2021-09-04","title":"4.3.2 (2021-09-04)","text":"TypeDescriptionPRIssuesAuthor Fix minimum `click` version is `7.1`, allow also `8.x`@NiklasRosenstein"},{"location":"changelog/#431-2021-09-01","title":"4.3.1 (2021-09-01)","text":"TypeDescriptionPRIssuesAuthor Fix Calling pydoc-markdown with `--render-toc` option causes an exception213@NiklasRosenstein"},{"location":"changelog/#430-2021-08-28","title":"4.3.0 (2021-08-28)","text":"TypeDescriptionPRIssuesAuthor Fix fix use of `docspec.ApiObject.path` after we migrated away from using deprecated `docspec.ReverseMap`@NiklasRosenstein Improvement change default configuration of `MarkdownRenderer` (`signature_with_vertical_bar = False` (many people seemed to dislike that) and `signature_with_def = True` (for consistency with the included `class` keyword for classes))@NiklasRosenstein"},{"location":"changelog/#420-2021-08-20","title":"4.2.0 (2021-08-20)","text":"TypeDescriptionPRIssuesAuthor Fix HugoRenderer: Enable Hugo `markup.goldmark.renderer.unsafe` option by default198@NiklasRosenstein Fix MarkdownRenderer: Markdown renderer produces header anchors with `name` attribute instead of `id`200@NiklasRosenstein Feature MarkdownRenderer: @melMass added the `MarkdownRenderer.add_module_prefix` option199@NiklasRosenstein Docs switch Pydoc-Markdown to generated its docs with MkDocs@NiklasRosenstein Docs add Jinja2 renderer documentation in generated docs@NiklasRosenstein Improvement update template for `--bootstrap readthedocs` and related documentation@NiklasRosenstein Fix fix `mkdocs` bootstrap configuration, update mkdocs and hugo bootstrap config to include example on how to select parts of the API docs@NiklasRosenstein"},{"location":"changelog/#416-2021-08-09","title":"4.1.6 (2021-08-09)","text":"TypeDescriptionPRIssuesAuthor Fix HugoRenderer: Restore old behaviour for `HugoConfig.additional_options`, which should be deserialized flat (i.e. it takes on any additional options in the same object that can not be mapped to any other fields of the config object)@NiklasRosenstein"},{"location":"changelog/#415-2021-08-04","title":"4.1.5 (2021-08-04)","text":"TypeDescriptionPRIssuesAuthor Fix fix import from `databind.core`@NiklasRosenstein"},{"location":"changelog/#414-2021-08-04","title":"4.1.4 (2021-08-04)","text":"TypeDescriptionPRIssuesAuthor Fix remove unused dependency on `nr.collections`@NiklasRosenstein Improvement Use `tempfile` instead of `nr.fs`@NiklasRosenstein"},{"location":"changelog/#413-2021-07-24","title":"4.1.3 (2021-07-24)","text":"TypeDescriptionPRIssuesAuthor Fix MarkdownRenderer: Remove zombie line that triggers error when using the Markdown renderer directly196@NiklasRosenstein"},{"location":"changelog/#412-2021-07-23","title":"4.1.2 (2021-07-23)","text":"TypeDescriptionPRIssuesAuthor Fix fix `--render-toc` option@NiklasRosenstein Feature Jinja2Renderer: add `blockquote` and `describe` built-in filters@NiklasRosenstein"},{"location":"changelog/#411-2021-07-22","title":"4.1.1 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Improvement Jinja2Renderer: added `format_function_signature` filter@NiklasRosenstein"},{"location":"changelog/#410-2021-07-22","title":"4.1.0 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Fix CrossrefProcessor: missing trailing characters for unresolved crossref@NiklasRosenstein Improvement MarkdownRenderer: add MarkdownReferenceResolver helper class@NiklasRosenstein Feature Add `jinja2` renderer@NiklasRosenstein"},{"location":"changelog/#401-2021-07-22","title":"4.0.1 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Fix fix Python version classifiers@NiklasRosenstein"},{"location":"changelog/#400-2021-07-22","title":"4.0.0 (2021-07-22)","text":"TypeDescriptionPRIssuesAuthor Breaking change Migrate to `databind.core 1.x` and `databind.json 1.x` from `nr.databind.core` and `nr.databin.json` and uses of `nr.interface` are replaced with ABCs. If you developed plugins for Pydoc-Markdown, please follow the guide at https://pydoc-markdown.readthedocs.io/en/latest/docs/migrate-from-3x-to-4x/. @NiklasRosenstein Fix docusaurus: Insert an additional newline after header anchors (``) when `MarkdownRenderer.insert_header_anchors` is enabled to fix Docusaurus header rendering. @NiklasRosenstein Fix unset `__PYENV_LAUNCHER__` environment variable for commands invoked via `$.hooks.pre-render` and `$.hooks.post-render` to avoid issues when the hook invokes a script installed into a different Python virtualenv than the virtualenv that is currently active in the terminal@NiklasRosenstein Improvement Pydoc-Markdown now requires Python 3.7 or newer (before it was 3.6 or newer). This is due to `databind.core` having that minimum version requirement@NiklasRosenstein"},{"location":"changelog/#3140-2021-07-19","title":"3.14.0 (2021-07-19)","text":"TypeDescriptionPRIssuesAuthor Feature add `MarkdownRenderer.signature_with_vertical_bar` option (contributed by @t6847kimo)192@NiklasRosenstein"},{"location":"changelog/#3130-2021-05-29","title":"3.13.0 (2021-05-29)","text":"TypeDescriptionPRIssuesAuthor Improvement upgrade to `docspec-python~0.2.0`@NiklasRosenstein"},{"location":"changelog/#3121-2021-05-21","title":"3.12.1 (2021-05-21)","text":"TypeDescriptionPRIssuesAuthor Fix add missing `dataclasses` dependency for Python 3.6 compatibility@NiklasRosenstein Fix set minimum Python version in `package.yml` to `^3.6`@NiklasRosenstein"},{"location":"changelog/#3120-2021-05-21","title":"3.12.0 (2021-05-21)","text":"TypeDescriptionPRIssuesAuthor Feature SphinxProcessor: parse `type` and `rtype`157@NiklasRosenstein"},{"location":"changelog/#3110-2021-05-20","title":"3.11.0 (2021-05-20)","text":"TypeDescriptionPRIssuesAuthor Feature Add support for getting configuration from pyproject.toml under the [tool.pydoc-markdown] table@NiklasRosenstein Fix fix docstring in PydocmdPreprocessor@NiklasRosenstein"},{"location":"changelog/#3103-2021-05-09","title":"3.10.3 (2021-05-09)","text":"TypeDescriptionPRIssuesAuthor Fix sort sidebar items in docusaurus183@NiklasRosenstein Fix replace backslashes with forward slashes in docusaurus sidebar (actually in 3.10.2)129@NiklasRosenstein"},{"location":"changelog/#3101-2021-04-02","title":"3.10.1 (2021-04-02)","text":"TypeDescriptionPRIssuesAuthor Fix fix code blocks indentation in `SphinxProcessor`179@NiklasRosenstein"},{"location":"changelog/#3100-2021-02-20","title":"3.10.0 (2021-02-20)","text":"TypeDescriptionPRIssuesAuthor Feature add `PythonLoader.encoding` option@NiklasRosenstein"},{"location":"changelog/#390-2020-12-15","title":"3.9.0 (2020-12-15)","text":"TypeDescriptionPRIssuesAuthor Fix Fix `IndexError` while processing short module path (by @g6123)167@NiklasRosenstein Improvement bump `watchdog` dependency to `^1.0.0`@NiklasRosenstein"},{"location":"changelog/#380-2020-11-06","title":"3.8.0 (2020-11-06)","text":"TypeDescriptionPRIssuesAuthor Feature add new `bitbucket` source linker (@hkenny, #163)@NiklasRosenstein"},{"location":"changelog/#370-2020-11-05","title":"3.7.0 (2020-11-05)","text":"TypeDescriptionPRIssuesAuthor Improvement FilterProcessor: Fix `NameError: name _check is not defined`, slightly alter behaviour of `FilterProcessor.expression` field`161@NiklasRosenstein"},{"location":"changelog/#361-2020-11-03","title":"3.6.1 (2020-11-03)","text":"TypeDescriptionPRIssuesAuthor Fix Fix using `data_code_block` option in `MarkdownRenderer`, and add a unit test for it160@NiklasRosenstein"},{"location":"changelog/#360-2020-10-28","title":"3.6.0 (2020-10-28)","text":"TypeDescriptionPRIssuesAuthor Feature Add `git` and `gitea` source linker (@tboulogne, #158)@NiklasRosenstein Improvement Update Docusaurus sidebar generation (@m-vdb, #156)@NiklasRosenstein"},{"location":"changelog/#350-2020-09-04","title":"3.5.0 (2020-09-04)","text":"TypeDescriptionPRIssuesAuthor Feature docusaurus: Add new `docusaurus` Renderer (contributed to by @m-vdb)151, 147@NiklasRosenstein Improvement markdown: Remove `MarkdownRenderer.fp` option, add `MarkdownRenderer.render_to_stream()`@NiklasRosenstein Feature filter: add `FilterProcessor.skip_empty_modules` option@NiklasRosenstein Feature markdown: Add `MarkdownRenderer.render_module_header_template` and `.escape_html_in_docstring` options@NiklasRosenstein Feature cli: Add `--bootstrap docusaurus` option@NiklasRosenstein"},{"location":"changelog/#340-2020-08-31","title":"3.4.0 (2020-08-31)","text":"TypeDescriptionPRIssuesAuthor Feature mkdocs: add `server_port` option, treat `MKDOCS_PORT` environment variable if `server_port` option is not set148@NiklasRosenstein"},{"location":"changelog/#331-2020-08-29","title":"3.3.1 (2020-08-29)","text":"TypeDescriptionPRIssuesAuthor Fix markdown: Fix \"list\" object has no attribute \"values\" in `MarkdownRenderer`149@NiklasRosenstein"},{"location":"changelog/#330-2020-07-17","title":"3.3.0 (2020-07-17)","text":"TypeDescriptionPRIssuesAuthor Feature plugin types can now be resolved by their FQN (i.e. the absolute import name, such as `pydoc_markdown.contrib.loaders.python.PythonLoader`) in addition to their registered entrypoint name.131@NiklasRosenstein Feature add new `SourceLinker` interface@NiklasRosenstein Feature add `GitHubSourceLinker` class (entrypoint name: `github`)@NiklasRosenstein Feature markdown: add `MarkdownRenderer.source_linker`, `.source_position` and `.source_format` options122@NiklasRosenstein Improvement cli: `-v,--verbose` and `-q,--quiet` flags are now countable (e.g. `-vv` will raise the logging verbosity to `DEBUG`)@NiklasRosenstein Improvement internal: Ensure consistency independent of the CWD from which Pydoc-Markdown is invoked as long as the same configuration file is used by introduce the `Context` object and the `init()` method for plugins. The `Context.directory` is set to the parent directory of the `pydoc-markdown.yml` configuration file. Plugins use that directory to interpret relative paths instead of the current working directory. @NiklasRosenstein Feature implement YTT-like YAML preprocessing when the Pydoc-Markdown configuration is loaded@NiklasRosenstein"},{"location":"changelog/#320post1-2020-07-15","title":"3.2.0.post1 (2020-07-15)","text":"TypeDescriptionPRIssuesAuthor Fix packaging: add `$.readme` to `pydoc-markdown/package.yaml`, fixing the generated `setup.py` to include the `README.md` from the parent folder.130@NiklasRosenstein"},{"location":"changelog/#320-2020-07-13","title":"3.2.0 (2020-07-13)","text":"TypeDescriptionPRIssuesAuthor Feature cli: add `--dump` and `--with-processors/--without-processors` options@NiklasRosenstein Docs add docstrings to classes defined in `pydoc_markdown.contrib.processors`@NiklasRosenstein Improvement use `docspec` module instead of `pydoc_markdown.reflection` to represent API objects@NiklasRosenstein Improvement python: use `docspec-python` to load Python API objects@NiklasRosenstein Improvement crossref: warnings produced about references that cannot be resolved are now summarized in a single log-line@NiklasRosenstein Improvement With the removal of `pydoc_markdown.reflection`, the `ModuleGraph` class has also been removed and replaced by List[docspec.Module]`@NiklasRosenstein Improvement filter: Rename FilterProcessor.include_root_objects to .do_not_filter_modules@NiklasRosenstein Improvement change type signatures and some method names of interfaces in `pydoc_markdown.interfaces`@NiklasRosenstein Improvement utils: The `Page.filtered_modules()` method now warns if an element in `Page.contents` did not match an API object@NiklasRosenstein Fix markdown: the Markdown header level for methods is now correctly read from the \"Method\" key in `MarkdownRenderer.header_level_by_type`121@NiklasRosenstein Improvement cli: remove `--bootstrap-mkdocs` in favor of `--bootstrap` option which now accepts an argument@NiklasRosenstein Improvement cli: the `--bootstrap` option now requires an argument, which must be either \"base\", \"mkdocs\" or \"hugo\" (new)@NiklasRosenstein Feature mkdocs: The `MkdocsRenderer.clean_render` option is enabled again by default, but instead of removing the whole `content_directory`, it will instead only remove files that it has previously generated (it will place a `.generated-files.txt` file in the `output_directory` for that).@NiklasRosenstein Feature cli: add `MarkdownRenderer.classdef_with_decorators` and `MarkdownRenderer.signature_with_decorators` options@NiklasRosenstein Feature Add new `HugoRenderer` (YAML type name `hugo`).106@NiklasRosenstein Feature smart-processor: now looks for a `@doc:fmt:` string in the docstring, which can be used to override the style that is used in case the automatically detected style is incorrect@NiklasRosenstein Docs The Pydoc-Markdown documentation is now available on Read the Docs (https://pydoc-markdown.readthedocs.io/en/latest/)@NiklasRosenstein Feature api: Add new `Builder` interface that is used with the new `--build` and `--site-dir` options@NiklasRosenstein Feature mkdocs: Implement `Builder` interface for `MkDocsRenderer`@NiklasRosenstein Feature hugo: Implement `Builder` interface for `HugoRenderer`@NiklasRosenstein Feature cli: Add new `--build` and `--site-dir` options as well as `--bootstrap readthedocs`@NiklasRosenstein Fix mkdocs: Fix error in MkDocs navigation generation if a page has no `source` and no `contents`@NiklasRosenstein Improvement mkdocs: generated `mkdocs.yml` now uses forward slashes for filenames on Windows system to increase portability129@NiklasRosenstein Feature add new `$.hooks.pre-render` and `$.hooks.post-render` options112@NiklasRosenstein"},{"location":"changelog/#311-2020-06-26","title":"3.1.1 (2020-06-26)","text":"TypeDescriptionPRIssuesAuthor Improvement dependencies: bump dependency on `nr.databind.core` to `~0.0.18` to avoid picking up the bad `0.0.17` version126@NiklasRosenstein"},{"location":"changelog/#310-2020-06-04","title":"3.1.0 (2020-06-04)","text":"TypeDescriptionPRIssuesAuthor Improvement cli: rename `--watch-and-serve` option to `--server`@NiklasRosenstein Improvement cli: watch and serve mainloop now reloads the config file and does not open the browser another time if it was already opened once.@NiklasRosenstein Fix cli: fix `pydoc-markdown.yml` generated with `--bootstrap`118@NiklasRosenstein Improvement markdown: * change default for `header_level_by_type` (`2` to `1` for modules, `3` to `2` for classes). * change default for `descriptive_class_title` (`false` to `true`) @NiklasRosenstein Feature markdown: added `content_directory` option (replaces hardcoded default `docs` value, defaults to `content` now)@NiklasRosenstein Improvement markdown: renamed `clean_docs_directory_on_render` to `clean_render` and change the default from `true` to `false`.@NiklasRosenstein Improvement mkdocs: `mkdocs_config` option can now be set to `null` (the renderer will the refrain from writing a `mkdocs.yml` file into the output directory). @NiklasRosenstein Fix python: fix assignments with annotations being ignored by the parser115@NiklasRosenstein"},{"location":"changelog/#302-2020-05-16","title":"3.0.2 (2020-05-16)","text":"TypeDescriptionPRIssuesAuthor Fix mkdocs: fix `NameError` in `MkdocsRenderer`@NiklasRosenstein"},{"location":"changelog/#301-2020-05-16","title":"3.0.1 (2020-05-16)","text":"TypeDescriptionPRIssuesAuthor Feature cli: added `--version` option@NiklasRosenstein Feature cli: added `-p,--package` option (which overrides `PythonLoader.packages`)@NiklasRosenstein Feature utils: added `pydoc_markdown.utils.page` module@NiklasRosenstein Feature cli: added `RenderSession` class to `pydoc_markdown.main` module which makes the cli logic easier to maintain and re-use.@NiklasRosenstein Feature markdown: added hidden `MarkdownRenderer.fp` option@NiklasRosenstein Feature python: added `PythonLoader.packages` option@NiklasRosenstein Improvement python: changed behavior of `PythonLoader.modules` option (it will not only load the module that was explicitly specified and exclude any sub-modules, if applicable).@NiklasRosenstein Improvement cli: dynamically lookup `MarkdownRenderer` configuration from the renderer to support renderers other than `MarkdownRenderer` and `MkdocsRenderer` that supply a `markdown` field that is an instance of `MarkdownRenderer` (so they can be used with `--render-toc` as well).@NiklasRosenstein"},{"location":"changelog/#300-2020-05-12","title":"3.0.0 (2020-05-12)","text":"TypeDescriptionPRIssuesAuthor Feature Initial release of Pydoc-Markdown v3.@NiklasRosenstein"},{"location":"contributing/","title":"Contributing to Pydoc-Markdown","text":"

Contributions to Pydoc-Markdown are very welcome!

If you want to talk about a potential contribution before investing any time, please do create a new topic on GitHub Discussions.

"},{"location":"contributing/#pull-request-requirements","title":"Pull request requirements","text":""},{"location":"contributing/#changelog-entries","title":"Changelog entries","text":"

Pydoc-Markdown uses Slam to manage changelogs. You should use the Slam CLI to add a new changelog entry, otherwise you need to manually generate a UUID-4.

$ slap changelog add -t <type> -d <changelog message> [--issue <issue_url>]\n

After you create the pull request, GitHub Actions will take care of injecting the PR URL into the changelog entry.

"},{"location":"api/cli/","title":"Command-line interface","text":"
Usage: pydoc-markdown [OPTIONS] [CONFIG]\n\n  Pydoc-Markdown is a renderer for Python API documentation in Markdown\n  format.\n\n  With no arguments it will load the default configuration file. If the\n  *config* argument is specified, it must be the name of a configuration file\n  or a YAML formatted object for the configuration.\n\nOptions:\n  --version                       Show the version and exit.\n  --bootstrap [base|mkdocs|hugo|readthedocs|docusaurus]\n                                  Create a Pydoc-Markdown configuration file\n                                  in the current working directory.\n  -v, --verbose                   Increase log verbosity.\n  -q, --quiet                     Decrease the log verbosity.\n  -m, --module MODULE             The module to parse and generated API\n                                  documentation for. Can be specified multiple\n                                  times. Using this option will disable\n                                  loading the default configuration file.\n  -p, --package PACKAGE           The package to parse and generated API\n                                  documentation for including all sub-packages\n                                  and -modules. Can be specified multiple\n                                  times. Using this option will disable\n                                  loading the default configuration file.\n  -I, --search-path PATH          A directory to use in the search for Python\n                                  modules. Can be specified multiple times.\n                                  Using this option will disable loading the\n                                  default configuration file.\n  --py2 / --py3                   Switch between parsing Python 2 and Python 3\n                                  code. The default is Python 3. Using --py2\n                                  will enable parsing code that uses the\n                                  \"print\" statement. This is equivalent of\n                                  setting the print_function option of the\n                                  \"python\" loader to False. Using this option\n                                  will disable loading the default\n                                  configuration file.\n  --render-toc / --no-render-toc  Enable/disable the rendering of the TOC in\n                                  the \"markdown\" renderer.\n  -s, --server                    Watch for file changes and re-render if\n                                  needed and start the server for the\n                                  configured renderer. This doesn't work for\n                                  all renderers.\n  -o, --open                      Open the browser after starting the server\n                                  with -s,--server.\n  --dump                          Dump the loaded modules in Docspec JSON\n                                  format to stdout, after the processors.\n  --with-processors / --without-processors\n                                  Enable/disable processors. Only with --dump.\n  --build                         Invoke a build after the Markdown files are\n                                  produced. Note that some renderers may not\n                                  support this option (e.g. the \"markdown\"\n                                  renderer).\n  --site-dir TEXT                 Set the output directory when using --build.\n  --help                          Show this message and exit.\n

Version: pydoc-markdown, version 4.8.2

"},{"location":"api/pydoc_markdown/","title":"Index","text":""},{"location":"api/pydoc_markdown/#class-pydocmarkdown","title":"Class PydocMarkdown","text":"
@dataclasses.dataclass\nclass PydocMarkdown()\n

[view_source]

This object represents the main configuration for Pydoc-Markdown.

"},{"location":"api/pydoc_markdown/#loaders","title":"loaders","text":"

A list of loader implementations that load docspec.Modules. Defaults to PythonLoader.

"},{"location":"api/pydoc_markdown/#processors","title":"processors","text":"

A list of processor implementations that modify docspec.Modules. Defaults to FilterProcessor, SmartProcessor and CrossrefProcessor.

"},{"location":"api/pydoc_markdown/#renderer","title":"renderer","text":"

A renderer for docspec.Modules. Defaults to MarkdownRenderer.

"},{"location":"api/pydoc_markdown/#hooks","title":"hooks","text":"

Hooks that can be executed at certain points in the pipeline. The commands are executed with the current SHELL.

"},{"location":"api/pydoc_markdown/#load_config","title":"load_config","text":"
def load_config(arg: t.Union[str, dict]) -> None\n

[view_source]

Loads the configuration from a nested data structure or filename as specified per the data

argument. If a filename is specified, it may be a JSON, YAML or TOML file. If the name of the TOML file is pyproject.yoml, the configuration will be read from the [tool.pydoc-markdown] section.

Arguments:

"},{"location":"api/pydoc_markdown/#init","title":"init","text":"
def init(context: Context) -> None\n

[view_source]

Initialize all plugins with the specified context. Cannot be called multiple times. If omitted, the plugins will be initialized with a default context before the load, process or render phase.

"},{"location":"api/pydoc_markdown/#load_modules","title":"load_modules","text":"
def load_modules() -> t.List[docspec.Module]\n

[view_source]

Loads modules via the loaders.

"},{"location":"api/pydoc_markdown/#process","title":"process","text":"
def process(modules: t.List[docspec.Module]) -> None\n

[view_source]

Process modules via the processors.

"},{"location":"api/pydoc_markdown/#render","title":"render","text":"
def render(modules: t.List[docspec.Module], run_hooks: bool = True) -> None\n

[view_source]

Render modules via the renderer.

"},{"location":"api/pydoc_markdown/interfaces/","title":"interfaces","text":"

This module defines the interfaces that can to be implemented for Pydoc-Markdown to implement custom loaders for documentation data, processors or renderers.

"},{"location":"api/pydoc_markdown/interfaces/#class-context","title":"Class Context","text":"
class Context()\n

[view_source]

Context data that is passed to plugins when they are loaded.

"},{"location":"api/pydoc_markdown/interfaces/#class-loader","title":"Class Loader","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.Loader\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass Loader(PluginBase)\n

[view_source]

This interface describes an object that is capable of loading documentation data. The location from which the documentation is loaded must be defined with the configuration class.

"},{"location":"api/pydoc_markdown/interfaces/#class-resolver","title":"Class Resolver","text":"
class Resolver(abc.ABC)\n

[view_source]

A resolver can be used by a Processor to replace cross references with a hyperlink.

"},{"location":"api/pydoc_markdown/interfaces/#class-resolverv2","title":"Class ResolverV2","text":"
class ResolverV2(abc.ABC)\n

[view_source]

New style interface for resolving based on a text ref from in the context of a docspec.ApiObject to find another. This is different from Resolver because it returns the resolved object directly, instead of some string representation of it.

"},{"location":"api/pydoc_markdown/interfaces/#class-processor","title":"Class Processor","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.Processor\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass Processor(PluginBase)\n

[view_source]

A processor is an object that takes a list of docspec.Modules as an input and transforms it in an arbitrary way. This usually processes docstrings to convert from various documentation syntaxes to plain Markdown.

"},{"location":"api/pydoc_markdown/interfaces/#class-renderer","title":"Class Renderer","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.Renderer\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass Renderer(PluginBase)\n

[view_source]

A renderer is an object that takes a list of docspec.Modules as an input and produces output files or writes to stdout. It may also expose additional command-line arguments. There can only be one renderer at the end of the processor chain.

Note that sometimes a renderer may need to perform some processing before the render step. To keep the possibility open that a renderer may implement generic processing that could used without the actual rendering functionality, Renderer is a subclass of Processor.

"},{"location":"api/pydoc_markdown/interfaces/#class-singlepagerenderer","title":"Class SinglePageRenderer","text":"
class SinglePageRenderer(PluginBase)\n

[view_source]

Interface for rendering a single page.

"},{"location":"api/pydoc_markdown/interfaces/#class-singleobjectrenderer","title":"Class SingleObjectRenderer","text":"
class SingleObjectRenderer(PluginBase)\n

[view_source]

Interface for rendering a single docspec.ApiObject.

"},{"location":"api/pydoc_markdown/interfaces/#class-server","title":"Class Server","text":"
class Server(abc.ABC)\n

[view_source]

This interface describes an object that can start a server process for live-viewing generated documentation in the browser. Renderer implementations may additionally implement this interface to advocate their compatibility with the --server and --open options of the pydoc-markdown CLI.

"},{"location":"api/pydoc_markdown/interfaces/#reload_server","title":"reload_server","text":"
def reload_server(process: subprocess.Popen) -> subprocess.Popen\n

[view_source]

Called when the files generated by pydoc-markdown have been updated. This gives the implementation a chance to reload the server process. The default implementation returns the process unchanged. Returning None will automatically call start_server() afterwards.

"},{"location":"api/pydoc_markdown/interfaces/#class-builder","title":"Class Builder","text":"
class Builder(abc.ABC)\n

[view_source]

This interface can be implemented additionally to the Renderer interface to indicate that the renderer supports building another produce after the markdown files have been rendered.

"},{"location":"api/pydoc_markdown/interfaces/#build","title":"build","text":"
@abc.abstractmethod\ndef build(site_dir: str) -> None\n

[view_source]

Invoke the build. The site_dir is the directory in which the output files should be placed. Otherwise, the directory may be determined by the builder.

"},{"location":"api/pydoc_markdown/interfaces/#class-sourcelinker","title":"Class SourceLinker","text":"
@Union(\n    [\n        \"!pydoc_markdown.interfaces.SourceLinker\",\n        \"<import>\",\n    ],\n    style=Union.FLAT,\n)\nclass SourceLinker(PluginBase)\n

[view_source]

This interface is used to determine the URL to the source of an API object. Renderers can use it to place a link to the source in the generated documentation.

"},{"location":"api/pydoc_markdown/loaders/","title":"pydoc_markdown.contrib.loaders.python","text":""},{"location":"api/pydoc_markdown/loaders/#class-pythonloader","title":"Class PythonLoader","text":"
@dataclasses.dataclass\nclass PythonLoader(Loader)\n

[view_source]

This implementation of the Loader interface parses Python modules and packages using docspec_python. See the options below to control which modules and packages are being loaded and how to configure the parser.

With no modules or packages set, the PythonLoader will discover available modules in the current and src/ directory.

lib2to3 Quirks

Pydoc-Markdown doesn't execute your Python code but instead relies on the lib2to3 parser. This means it also inherits any quirks of lib2to3.

List of known quirks

"},{"location":"api/pydoc_markdown/loaders/#packages","title":"packages","text":"

A list of package names that this loader will search for and then parse, including all sub-packages and modules.

"},{"location":"api/pydoc_markdown/loaders/#search_path","title":"search_path","text":"

The module search path. If not specified, the current sys.path is used instead. If any of the elements contain a * (star) symbol, it will be expanded with sys.path.

"},{"location":"api/pydoc_markdown/loaders/#ignore_when_discovered","title":"ignore_when_discovered","text":"

List of modules to ignore when using module discovery on the search_path.

"},{"location":"api/pydoc_markdown/loaders/#parser","title":"parser","text":"

Options for the Python parser.

"},{"location":"api/pydoc_markdown/loaders/#encoding","title":"encoding","text":"

The encoding to use when reading the Python source files.

Changed in 4.7.0: Default changed from None (system default encoding) to \"utf-8\".

"},{"location":"api/pydoc_markdown/processors/","title":"pydoc_markdown.contrib.processors","text":"

Module: pydoc_markdown.contrib.processors.crossref

"},{"location":"api/pydoc_markdown/processors/#class-crossrefprocessor","title":"Class CrossrefProcessor","text":"
@dataclasses.dataclass\nclass CrossrefProcessor(Processor)\n

[view_source]

Finds references to other objects in Markdown docstrings and produces links to other pages. The links are provided by the current Renderer via the Resolver interface.

Note: This processor is a work in progress, and most of the time it just converts references into inline-code.

The syntax for cross references is as follows:

This is a ref to another class: [PydocmdProcessor](#pydoc:pydoc_markdown.contrib.processors.pydocmd.PydocmdProcessor)\nYou can rename a ref like `this`~PydocmdProcessor\nAnd you can append to the ref name like this: [PydocmdProcessors](#pydoc:pydoc_markdown.contrib.processors.pydocmd.PydocmdProcessor)\n

Renders as

This is a ref to another class: PydocmdProcessor You can rename a ref like this~PydocmdProcessor And you can append to the ref name like this: PydocmdProcessors

Example configuration:

processors:\n  - type: crossref\n

"},{"location":"api/pydoc_markdown/processors/#resolver_v2","title":"resolver_v2","text":"

If specified, it will be used instead of the resolver passed to process() and the generated Markdown code for the reference uses Novella {@link } syntax.

Module: pydoc_markdown.contrib.processors.filter

"},{"location":"api/pydoc_markdown/processors/#class-filterprocessor","title":"Class FilterProcessor","text":"
@dataclasses.dataclass\nclass FilterProcessor(Processor)\n

[view_source]

The filter processor removes module and class members based on certain criteria.

Example configuration:

- type: filter\n  expression: not name.startswith('_') and default()\n  documented_only: false\n
"},{"location":"api/pydoc_markdown/processors/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/processors/#expression","title":"expression","text":"

A Python expression that is evaluated given the variables name, obj and default and is expected to return a boolean to indicate whether the docspec.ApiObject should be kept or removed. If specified, the expression is the ultimate truth for determining the keep-or-remove state of a node. Using 'default()' as the expression has the same semantic as not specifying this field. Default: null

"},{"location":"api/pydoc_markdown/processors/#documented_only","title":"documented_only","text":"

Keep only API objects that have docstrings. Default: true

"},{"location":"api/pydoc_markdown/processors/#exclude_private","title":"exclude_private","text":"

Exclude API objects that appear to be private members (i.e. their name begins with and underscore but does not end with one). Default: true

"},{"location":"api/pydoc_markdown/processors/#exclude_special","title":"exclude_special","text":"

Exclude special members (e.g.__path__, __annotations__, __name__ and __all__). Default: true

"},{"location":"api/pydoc_markdown/processors/#do_not_filter_modules","title":"do_not_filter_modules","text":"

Do not filter docspec.Module objects. Default: true

"},{"location":"api/pydoc_markdown/processors/#skip_empty_modules","title":"skip_empty_modules","text":"

Skip modules with no content. Default: false.

Module: pydoc_markdown.contrib.processors.google

"},{"location":"api/pydoc_markdown/processors/#class-googleprocessor","title":"Class GoogleProcessor","text":"
@dataclasses.dataclass\nclass GoogleProcessor(Processor)\n

[view_source]

This class implements the preprocessor for Google and PEP 257 docstrings. It converts docstrings formatted in the Google docstyle to Markdown syntax.

References:

Example:

Attributes:\n    module_level_variable1 (int): Module level variables may be documented in\n        either the ``Attributes`` section of the module docstring, or in an\n        inline docstring immediately following the variable.\n\n        Either form is acceptable, but the two should not be mixed. Choose\n        one convention to document module level variables and be consistent\n        with it.\n\nTodo:\n    * For module TODOs\n    * You have to also use ``sphinx.ext.todo`` extension\n

Renders as:

Attributes:

Either form is acceptable, but the two should not be mixed. Choose one convention to document module level variables and be consistent with it.

Todo:

Module: pydoc_markdown.contrib.processors.pydocmd

"},{"location":"api/pydoc_markdown/processors/#class-pydocmdprocessor","title":"Class PydocmdProcessor","text":"
@dataclasses.dataclass\nclass PydocmdProcessor(Processor)\n

[view_source]

The Pydoc-Markdown processor for Markdown docstrings. This processor parses docstrings formatted like the examples below and turns them into proper Markdown markup.

Examples:

# Arguments\n\narg1 (int): The first argument.\nkwargs (dict): Keyword arguments.\n\n# Raises\nRuntimeError: If something bad happens.\nValueError: If an invalid argument is specified.\n\n# Returns\nA value.\n

Renders as:

Arguments

Raises

Returns

A value.

Module: pydoc_markdown.contrib.processors.smart

"},{"location":"api/pydoc_markdown/processors/#class-smartprocessor","title":"Class SmartProcessor","text":"
@dataclasses.dataclass\nclass SmartProcessor(Processor)\n

[view_source]

This processor picks the GoogleProcessor, SphinxProcessor or PydocmdProcessor after guessing which is appropriate from the syntax it finds in the docstring.

Module: pydoc_markdown.contrib.processors.sphinx

"},{"location":"api/pydoc_markdown/processors/#class-sphinxprocessor","title":"Class SphinxProcessor","text":"
@dataclasses.dataclass\nclass SphinxProcessor(Processor)\n

[view_source]

This processor parses ReST/Sphinx-style function documentation and converts it into

Markdown syntax.

Example:

**Arguments**:\n\n- `arg1`: This is the first argument.\n- `arg1`: This is the first argument.\n\n**Raises**:\n\n- `ValueError`: If *arg1* is a bad value.\n- `ValueError`: If *arg1* is a bad value.\n\n**Returns**:\n\nAn `int` that represents an interesting value.\n

Renders as:

"},{"location":"api/pydoc_markdown/renderers/docusaurus/","title":"docusaurus","text":""},{"location":"api/pydoc_markdown/renderers/docusaurus/#class-customizedmarkdownrenderer","title":"Class CustomizedMarkdownRenderer","text":"
@dataclasses.dataclass\nclass CustomizedMarkdownRenderer(MarkdownRenderer)\n

[view_source]

We override some defaults in this subclass.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#insert_header_anchors","title":"insert_header_anchors","text":"

Disabled because Docusaurus supports this automatically.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#escape_html_in_docstring","title":"escape_html_in_docstring","text":"

Escape html in docstring, otherwise it could lead to invalid html.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#render_module_header_template","title":"render_module_header_template","text":"

Conforms to Docusaurus header format.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#class-docusaurusrenderer","title":"Class DocusaurusRenderer","text":"
@dataclasses.dataclass\nclass DocusaurusRenderer(Renderer)\n

[view_source]

Produces Markdown files and a sidebar.json file for use in a Docusaurus v2 websites. It creates files in a fixed layout that reflects the structure of the documented packages. The files will be rendered into the directory specified with the docs_base_path option.

Check out the complete Docusaurus example on GitHub.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/docusaurus/#markdown","title":"markdown","text":"

The MarkdownRenderer configuration.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#docs_base_path","title":"docs_base_path","text":"

The path where the docusaurus docs content is. Defaults \"docs\" folder.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#relative_output_path","title":"relative_output_path","text":"

The output path inside the docs_base_path folder, used to output the module reference.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#relative_sidebar_path","title":"relative_sidebar_path","text":"

The sidebar path inside the docs_base_path folder, used to output the sidebar for the module reference.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#sidebar_top_level_label","title":"sidebar_top_level_label","text":"

The top-level label in the sidebar. Default to 'Reference'. Can be set to null to remove the sidebar top-level all together. This option assumes that there is only one top-level module.

"},{"location":"api/pydoc_markdown/renderers/docusaurus/#sidebar_top_level_module_label","title":"sidebar_top_level_module_label","text":"

The top-level module label in the sidebar. Default to null, meaning that the actual module name will be used. This option assumes that there is only one top-level module.

"},{"location":"api/pydoc_markdown/renderers/hugo/","title":"hugo","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#class-hugopage","title":"Class HugoPage","text":"
@dataclasses.dataclass\nclass HugoPage(GenericPage[\"HugoPage\"])\n

[view_source]

A subclass of {@link pydoc:pydoc_markdown.util.pages.Page} which adds Hugo-specific overrides.

"},{"location":"api/pydoc_markdown/renderers/hugo/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#preamble","title":"preamble","text":"

The Hugo preamble of the page. This is merged with the HugoRenderer.default_preamble.

"},{"location":"api/pydoc_markdown/renderers/hugo/#directory","title":"directory","text":"

Override the directory that this page is rendered into (relative to the content directory). Defaults to null.

"},{"location":"api/pydoc_markdown/renderers/hugo/#class-hugoconfig","title":"Class HugoConfig","text":"
@dataclasses.dataclass\nclass HugoConfig()\n

[view_source]

Represents the Hugo configuration file that is rendered into the build directory.

"},{"location":"api/pydoc_markdown/renderers/hugo/#options_1","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#title","title":"title","text":"

Title of the site. This is a mandatory field.

"},{"location":"api/pydoc_markdown/renderers/hugo/#theme","title":"theme","text":"

The theme of the site. This is a mandatory field. It must be a string, a HugoThemePath or a HugoThemeGitUrl object. Examples:

theme: antarctica\ntheme: {clone_url: \"https://github.com/alex-shpak/hugo-book.git\"}\ntheme: docs/hugo-theme/\n

"},{"location":"api/pydoc_markdown/renderers/hugo/#baseurl","title":"baseURL","text":"

Base URL.

"},{"location":"api/pydoc_markdown/renderers/hugo/#serverurl","title":"serverURL","text":"

Server URL. Default: 127.0.0.1 aka localhost

"},{"location":"api/pydoc_markdown/renderers/hugo/#serverport","title":"serverPort","text":"

Server Port. Default: 1313

"},{"location":"api/pydoc_markdown/renderers/hugo/#languagecode","title":"languageCode","text":"

Language code. Default: en-us

"},{"location":"api/pydoc_markdown/renderers/hugo/#class-hugorenderer","title":"Class HugoRenderer","text":"
@dataclasses.dataclass\nclass HugoRenderer(Renderer, Server, Builder)\n

[view_source]

A renderer that produces Markdown files compatible with Hugo. The --bootstrap hugo option can be used to create a Pydoc-Markdown configuration file with the Hugo template.

Example configuration:

renderer:\n  type: hugo\n  config:\n    title: My Project\n    theme: {clone_url: \"https://github.com/alex-shpak/hugo-book.git\"}\n  # The \"book\" theme only renders pages in \"content/docs\" into the nav.\n  content_directory: content/docs\n  default_preamble: {menu: main}\n  pages:\n    - title: Home\n      name: index\n      source: README.md\n    - title: API Documentation\n      contents:\n        - '*'\n
"},{"location":"api/pydoc_markdown/renderers/hugo/#options_2","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/hugo/#build_directory","title":"build_directory","text":"

The directory where all generated files are placed. Default: build/docs

"},{"location":"api/pydoc_markdown/renderers/hugo/#content_directory","title":"content_directory","text":"

The directory inside the build directory where the generated pages are written to. Default: content

"},{"location":"api/pydoc_markdown/renderers/hugo/#clean_render","title":"clean_render","text":"

Clean up files that were previously generated by the renderer before the next render pass. Defaults to True.

"},{"location":"api/pydoc_markdown/renderers/hugo/#pages","title":"pages","text":"

The pages to render.

"},{"location":"api/pydoc_markdown/renderers/hugo/#default_preamble","title":"default_preamble","text":"

The default Hugo preamble that is applied to every page. Example:

default_preamble:\n  menu: main\n

"},{"location":"api/pydoc_markdown/renderers/hugo/#markdown","title":"markdown","text":"

The MarkdownRenderer configuration.

"},{"location":"api/pydoc_markdown/renderers/hugo/#config","title":"config","text":"

The contents of the Hugo config.toml file as YAML. This can be set to null in order to not produce the config.toml file in the build_directory. Must be deserializable into a HugoConfig.

"},{"location":"api/pydoc_markdown/renderers/hugo/#get_hugo","title":"get_hugo","text":"

Options for when the Hugo binary is not present and should be downloaded automatically. Example:

get_hugo:\n  enabled: true\n  version: '0.71'\n  extended: true\n

"},{"location":"api/pydoc_markdown/renderers/hugo/#install_hugo","title":"install_hugo","text":"
def install_hugo(to: str,\n                 version: str | None = None,\n                 extended: bool = True) -> None\n

[view_source]

Downloads the latest release of Hugo from Github

and places it at the path specified by to. This will install the extended version if it is available and extended is set to True.

Arguments:

"},{"location":"api/pydoc_markdown/renderers/hugo/#get_github_releases","title":"get_github_releases","text":"
def get_github_releases(repo: str) -> t.Generator[dict, None, None]\n

[view_source]

Returns an iterator for all releases of a Github repository.

"},{"location":"api/pydoc_markdown/renderers/hugo/#parse_links_header","title":"parse_links_header","text":"
def parse_links_header(link_header: str) -> t.Dict[str, str]\n

[view_source]

Parses the Link HTTP header and returns a map of the links. Logic from PageLinks.java.

"},{"location":"api/pydoc_markdown/renderers/jinja2/","title":"jinja2","text":"

at any point on future Pydoc-Markdown versions.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#class-renderblock","title":"Class RenderBlock","text":"
@D.dataclass\nclass RenderBlock()\n

[view_source]

"},{"location":"api/pydoc_markdown/renderers/jinja2/#template","title":"template","text":"

The path to the Jinja2 template that is used to render the output files.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#produces","title":"produces","text":"

A mapping for filename (without suffix) to a list of Module selectors.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#jinja2_environment_settings","title":"jinja2_environment_settings","text":"

Settings for the Jinja2 Environment.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#class-jinja2renderer","title":"Class Jinja2Renderer","text":"
@D.dataclass\nclass Jinja2Renderer(Renderer)\n

[view_source]

"},{"location":"api/pydoc_markdown/renderers/jinja2/#renders","title":"renders","text":"

Render instructions.

"},{"location":"api/pydoc_markdown/renderers/jinja2/#build_directory","title":"build_directory","text":"

Build directory where all the files are produced.

"},{"location":"api/pydoc_markdown/renderers/markdown/","title":"markdown","text":""},{"location":"api/pydoc_markdown/renderers/markdown/#class-markdownrenderer","title":"Class MarkdownRenderer","text":"
@dataclasses.dataclass\nclass MarkdownRenderer(Renderer, SinglePageRenderer, SingleObjectRenderer)\n

[view_source]

Produces Markdown files. This renderer is often used by other renderers, such as MkdocsRenderer and HugoRenderer. It provides a wide variety of options to customize the generated Markdown files.

"},{"location":"api/pydoc_markdown/renderers/markdown/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/markdown/#filename","title":"filename","text":"

The name of the file to render to. If no file is specified, it will render to stdout.

"},{"location":"api/pydoc_markdown/renderers/markdown/#encoding","title":"encoding","text":"

The encoding of the output file. This is ignored when rendering to stdout.

"},{"location":"api/pydoc_markdown/renderers/markdown/#insert_header_anchors","title":"insert_header_anchors","text":"

If enabled, inserts anchors before Markdown headers to ensure that links to the header work. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#html_headers","title":"html_headers","text":"

Generate HTML headers instead of Mearkdown headers. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#code_headers","title":"code_headers","text":"

Render names in headers as code (using backticks or <code> tags, depending on html_headers). This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#descriptive_class_title","title":"descriptive_class_title","text":"

Generate descriptive class titles by adding the word \"Objects\" if set to True. Otherwise, it can be a string that is appended or prepended (appended if the string begins with $). the class name. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#descriptive_module_title","title":"descriptive_module_title","text":"

Generate descriptivie module titles by adding the word \"Module\" before the module name. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_module_prefix","title":"add_module_prefix","text":"

Add the module name as a prefix to class & method names. This module name is also rendered as code if code_headers is enabled. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_method_class_prefix","title":"add_method_class_prefix","text":"

Add the class name as a prefix to method names. This class name is also rendered as code if code_headers is enabled. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_member_class_prefix","title":"add_member_class_prefix","text":"

Add the class name as a prefix to member names. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#add_full_prefix","title":"add_full_prefix","text":"

Add the full module name as a prefix to the title of the header. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#sub_prefix","title":"sub_prefix","text":"

If add_full_prefix is enabled, this will result in the prefix to be wrapped in a <sub> tag.

"},{"location":"api/pydoc_markdown/renderers/markdown/#data_code_block","title":"data_code_block","text":"

Render the definition of data members as a code block. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#data_expression_maxlength","title":"data_expression_maxlength","text":"

Max length of expressions. If this limit is exceeded, the remaining characters will be replaced with three dots. This is set to 100 by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#classdef_code_block","title":"classdef_code_block","text":"

Render the class signature as a code block. This includes the \"class\" keyword, the class name and its bases. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#classdef_with_decorators","title":"classdef_with_decorators","text":"

Render decorators before class definitions.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_python_help_style","title":"signature_python_help_style","text":"

Render classdef and function signature blocks in the Python help() style.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_code_block","title":"signature_code_block","text":"

Render the function signature as a code block. This includes the \"def\" keyword, the function name and its arguments. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_in_header","title":"signature_in_header","text":"

Render the function signature in the header. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_with_vertical_bar","title":"signature_with_vertical_bar","text":"

Render the vertical bar '|' before function signature. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_with_def","title":"signature_with_def","text":"

Include the \"def\" keyword in the function signature. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_class_prefix","title":"signature_class_prefix","text":"

Render the class name in the code block for function signature. Note that this results in invalid Python syntax to be rendered. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#signature_with_decorators","title":"signature_with_decorators","text":"

Render decorators before function definitions.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_typehint_in_data_header","title":"render_typehint_in_data_header","text":"

Render type hints for data elements in the header.

"},{"location":"api/pydoc_markdown/renderers/markdown/#code_lang","title":"code_lang","text":"

Add the string \"python\" after the backticks for code blocks. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_page_title","title":"render_page_title","text":"

Render title of page at the beginning of the file.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_toc","title":"render_toc","text":"

Render a table of contents at the beginning of the file.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_toc_title","title":"render_toc_title","text":"

The title of the \"Table of Contents\" header.

"},{"location":"api/pydoc_markdown/renderers/markdown/#toc_maxdepth","title":"toc_maxdepth","text":"

The maximum depth of the table of contents. Defaults to 2.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_module_header","title":"render_module_header","text":"

Render module headers. This is enabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_module_header_template","title":"render_module_header_template","text":"

Custom template for module header.

"},{"location":"api/pydoc_markdown/renderers/markdown/#docstrings_as_blockquote","title":"docstrings_as_blockquote","text":"

Render docstrings as blockquotes. This is disabled by default.

"},{"location":"api/pydoc_markdown/renderers/markdown/#use_fixed_header_levels","title":"use_fixed_header_levels","text":"

Use a fixed header level for every kind of API object. The individual levels can be defined with header_level_by_type.

"},{"location":"api/pydoc_markdown/renderers/markdown/#header_level_by_type","title":"header_level_by_type","text":"

Fixed header levels by API object type.

"},{"location":"api/pydoc_markdown/renderers/markdown/#source_linker","title":"source_linker","text":"

A plugin that implements the SourceLinker interface to provide links to the source code of API objects. If this field is specified, the renderer will place links to the source code in the generated Markdown files.

"},{"location":"api/pydoc_markdown/renderers/markdown/#source_format","title":"source_format","text":"

Allows you to override how the \"view source\" link is rendered into the Markdown file if a source_linker is configured. The default is [[view_source]]({url}).

"},{"location":"api/pydoc_markdown/renderers/markdown/#escape_html_in_docstring","title":"escape_html_in_docstring","text":"

Escape html in docstring. Default to False.

"},{"location":"api/pydoc_markdown/renderers/markdown/#render_novella_anchors","title":"render_novella_anchors","text":"

Render Novella @anchor tags before headings.

"},{"location":"api/pydoc_markdown/renderers/markdown/#format_code","title":"format_code","text":"

Format code rendered into Markdown code blocks with YAPF.

"},{"location":"api/pydoc_markdown/renderers/markdown/#format_code_style","title":"format_code_style","text":"

The style to format code as. This can be a YAPF builtin style name or point to a file relative to the context directory (usually the working directory).

"},{"location":"api/pydoc_markdown/renderers/markdown/#get_resolver","title":"get_resolver","text":"
def get_resolver(modules: t.List[docspec.Module]) -> t.Optional[Resolver]\n

[view_source]

Returns a simple Resolver implementation. Finds cross-references in the same file.

"},{"location":"api/pydoc_markdown/renderers/markdown/#class-markdownreferenceresolver","title":"Class MarkdownReferenceResolver","text":"
@dataclasses.dataclass\nclass MarkdownReferenceResolver(Resolver, ResolverV2)\n

[view_source]

"},{"location":"api/pydoc_markdown/renderers/markdown/#resolve_reference","title":"resolve_reference","text":"
def resolve_reference(suite: ApiSuite, scope: docspec.ApiObject,\n                      ref: str) -> t.Optional[docspec.ApiObject]\n

[view_source]

Resolves the reference by searching in the members of scope or any of its parents.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/","title":"mkdocs","text":""},{"location":"api/pydoc_markdown/renderers/mkdocs/#class-customizedmarkdownrenderer","title":"Class CustomizedMarkdownRenderer","text":"
@dataclasses.dataclass\nclass CustomizedMarkdownRenderer(MarkdownRenderer)\n

[view_source]

We override some defaults in this subclass.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#class-mkdocsrenderer","title":"Class MkdocsRenderer","text":"
@dataclasses.dataclass\nclass MkdocsRenderer(Renderer, Server, Builder)\n

[view_source]

Produces Markdown files in a layout compatible with [MkDocs][0] and can be used with the Pydoc-Markdown --server option for a live-preview. The --bootstrap mkdocs option can be used to create a Pydoc-Markdown configuration file with the MkDocs template.

Example configuration:

renderer:\n  type: mkdocs\n  pages:\n    - title: Home\n      name: index\n      source: README.md\n    - title: API Documentation\n      contents:\n        - '*'\n  mkdocs_config:\n    site_name: My Project\n    theme: readthedocs\n
"},{"location":"api/pydoc_markdown/renderers/mkdocs/#options","title":"Options","text":""},{"location":"api/pydoc_markdown/renderers/mkdocs/#output_directory","title":"output_directory","text":"

The output directory for the generated Markdown files. Defaults to build/docs.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#content_directory_name","title":"content_directory_name","text":"

Name of the content directory (inside the output_directory). Defaults to \"content\".

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#clean_render","title":"clean_render","text":"

Remove files generated in a previous pass by the Mkdocs renderer before rendering again. Defaults to True.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#markdown","title":"markdown","text":"

Markdown renderer settings.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#site_name","title":"site_name","text":"

The name of the site. This will be carried into the site_name key of the mkdocs_config.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#mkdocs_config","title":"mkdocs_config","text":"

Arbitrary configuration values that will be rendered to an mkdocs.yml file.

"},{"location":"api/pydoc_markdown/renderers/mkdocs/#server_port","title":"server_port","text":"

Port for the Mkdocs server when using the pydoc-markdown --server option. Defaults to 8000. Can be set with the MKDOCS_PORT environment variable:

$ MKDOCS_PORT=8383 pydoc-markdown -so\n
"},{"location":"examples/hugo/","title":"Hugo","text":""},{"location":"examples/hugo/#tips-tricks","title":"Tips & Tricks","text":""},{"location":"examples/hugo/#hugo-baseurl","title":"Hugo baseURL","text":"

When using Hugo, usually you want to set the baseURL configuration so that it can generated permalinks properly. If you are building on Read the Docs, chances are that you will have multiple versions of the documentation, which all require a different baseURL.

Pydoc-Markdown configuration files are pre-processed with a YTT-like templating language.

#@ def base_url():\n#@    if env.READTHEDOCS:\n#@      return \"https://pydoc-markdown.readthedocs.io/en/\" + env.READTHEDOCS_VERSION + \"/\"\n#@    else:\n#@      return None\n#@ end\n\nrenderer:\n  type: hugo\n  config:\n    baseURL: #@ base_url()\n
"},{"location":"examples/readthedocs/","title":"Read the Docs","text":"

Using Pydoc-Markdown on readthedocs.org requires some \"hacking\" because natively it does not allow you to run any custom commands. Using readthedocs-custom-steps, you can hook into the call that RTD expects to generate the documentation using Sphinx/MkDocs and run your own commands instead.

Example

.readthedocs.ymlsetup.cfgpyproject.toml
version: 2\nmkdocs: {}  # tell readthedocs to use mkdocs\npython:\n  version: 3.7\n  install:\n  - method: pip\n    extra_requirements:\n    - rtd\n
[options.extras_require]\nrtd = readthedocs-custom-steps==0.6.2\n
# ...\n\n[tool.readthedocs-custom-steps]\nscript = \"\"\"\nnovella --site-dir _site/html\n\"\"\"\n
"},{"location":"usage/cli-and-api/","title":"CLI and API","text":"

If you only want to use Pydoc-Markdown to generate Markdown from Python code, but not use it for anything else (such as interfacing with a static site generator), you can of course do that. You can make use of the Class PythonLoader and Class MarkdownRenderer, or more conveniently the Class PydocMarkdown APIs, or use the CLI.

"},{"location":"usage/cli-and-api/#cli-example","title":"CLI Example","text":"

The Pydoc-Markdown CLI accepts some options that can modify the default configuration (i.e. the Python loader and Markdown renderer) and write the generated Markdown to stdout.

pydoc-markdown -I src -m package_name.module_name --render-toc > module_name.md\n

You can also supply a YAML configuration as a positional argument that will be treated the same way as if it was loaded from a pydoc-markdown.yml file.

pydoc-markdown -m my_module '{\n    renderer: {\n      type: markdown,\n      descriptive_class_title: false,\n      render_toc: true\n    }\n  }' > my_module.md\n
"},{"location":"usage/cli-and-api/#api-example","title":"API Example","text":"Example 1Example 2
from pydoc_markdown.interfaces import Context\nfrom pydoc_markdown.contrib.loaders.python import PythonLoader\nfrom pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer\n\ncontext = Context(directory='.')\nloader = PythonLoader(search_path=['src'])\nrenderer = MarkdownRenderer(render_module_header=False)\n\nloader.init(context)\nrenderer.init(context)\n\nmodules = loader.load()\nprint(renderer.render_to_string(modules))\n

Note

This does not include any filtering logic and will just render every member in your Python code.

from pydoc_markdown import PydocMarkdown\nfrom pydoc_markdown.contrib.loaders.python import PythonLoader\nfrom pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer\n\nsession = PydocMarkdown()  # Preconfigured with a PythonLoader, FilterProcessor, CrossRefProcess, SmartProcessor and MarkdownRenderer\n\nassert isinstance(session.loaders[0], PythonLoader)\nsession.loaders[0].search_path = [\"src\"]\n\nassert isinstance(session.renderer, MarkdownRenderer)\nsession.renderer.render_to_string(session.process(session.load_modules()))\n
"},{"location":"usage/novella/","title":"Novella","text":""},{"location":"usage/novella/#getting-started","title":"Getting started","text":"

When using the Pydoc-Markdown integration with Novella to make use of its Markdown pre-processing capabilities, Pydoc-Markdown comes as a plugin that provides a @pydoc and @pylink tag to insert Markdown documentation generated by Pydoc-Markdown in the corresponding places of your documentation.

"},{"location":"usage/novella/#installation","title":"Installation","text":"

When using Pipx, the recommended installation method is to inject Pydoc-Markdown later:

$ pipx install novella\n$ pipx inject novella pydoc-markdown[novella]\n

If you manage the environment yourself, it's sufficient to install Pydoc-Markdown with the novella extra.

$ pip install pydoc-markdown[novella]\n
"},{"location":"usage/novella/#configuration","title":"Configuration","text":"

A Novella build is configured using a build.novella script. In most cases you want to rely on a template provided by Novella, such as the MkDocs template. Check out the Novella documentation to find what types of templates are available here.

docs/build.novella
template \"mkdocs\" {\n  content_directory = \"content\"\n}\n\naction \"preprocess-markdown\" {\n  use \"pydoc\"\n}\n

What is happening here?

  1. The mkdocs pipeline template is applied. The content_directory is the directory that contains your MkDocs source files. It will be copied to the temporary build location alongside the mkdocs.yml file. Note that your build.novella script should sit next two these files.

Note: You should have mkdocs on your PATH and it should have the mkdocs-material theme installed (the default theme that Novella will apply if you don't specify a different one in your mkdocs.yml file or in build.novella).

  1. The preprocess-markdown action that is one of the actions created by the template is retrieved and configured further. We instruct it to make use of the \"pydoc\" plugin, which is implemented by Pydoc-Markdown and provides the @pydoc and {@link pydoc:} tags.

Note

"},{"location":"usage/novella/#using-novella-tags","title":"Using Novella tags","text":"

For example, the @cat tag is useful to inject the content of another file.

docs/content/index.md
# Welcome to my Project documentation!\n\n@cat ../../readme.md :with slice_lines = \"2:\"\n

The @pydoc tag is the piece provided by Pydoc-Markdown itself. It uses the Class MarkdownRenderer to generate Markdown formatted API documentation of the API object you specify.

docs/content/api.md
# API Documentation\n\n@pydoc my_module.SomeClass\n
"},{"location":"usage/novella/#build-the-documentation","title":"Build the documentation","text":"

Change into the docs/ directory where your build.novella script resides and invoke the Novella CLI. The MkDocs template exposes some command-line arguments that you can pass through the CLI, one of which is the --serve option that runs MkDocs in the server mode instead of building the documentation and writing it to disk.

$ novella --help
usage: novella [--version] [-h] [-i TEMPLATE] [-c PATH] [-d DIRECTORY]\n               [-b PATH] [-r] [--dot] [--intercept ACTION] [--serve]\n               [--port PORT] [--site-dir PATH] [--base-url URL]\n\noptions:\n  --version             show program's version number and exit\n  -h, --help            Show this help output.\n  -i TEMPLATE, --init TEMPLATE\n                        Create a `build.novella` file initialized from a\n                        template. Available templates are: \"mkdocs\", \"hugo\"\n  -c PATH, --config-file PATH\n                        The configuration file to load. Can be a\n                        pyproject.toml in which case the code is looked up\n                        under the tool.novella.script key. (default: None)\n  -d DIRECTORY, --directory DIRECTORY\n                        Switch to the specified directory before executing the\n                        configuration file.\n  -b PATH, --build-directory PATH\n                        The build directory. If not specified, a temporary\n                        directory will be created.\n  -r, --use-reloader    Enable reloading, which will re-execute the pipeline\n                        if a watched file changes.\n  --dot                 Produce a DotViz representation of the build graph.\n  --intercept ACTION    The name of an action to intercept and pause the\n                        execution, waiting for user input to continue. Useful\n                        for debugging intermediate steps of the build process.\n                        Currently, the action name must be matched exactly and\n                        actions can only be intercepted before they are run.\n                        If this option is provided, all possible intercept\n                        points are logged to the console.\n\ntemplate (mkdocs):\n  --serve               Use mkdocs serve\n  --port PORT           The port to serve under\n  --site-dir PATH       Build directory for MkDocs (defaults to \"_site\")\n  --base-url URL        The base URL to prefix to autogenerated link inside\n                        the documentation.\n
"},{"location":"usage/novella/#advantages-over-the-yaml-configuration","title":"Advantages over the YAML Configuration","text":"

The YAML Configuration allows you to define in one file all pages and the Python API objects they should contain. However, when you use Novella, each page will need to exist as a Markdown file. This has a few advantages:

Now, if you still want to generate Markdown files at build time, Pydoc-Markdown does not currently provide any functionality to do that; although some discussion around the topic is happening in #245. However, the Novella build script is just code, so if you really need it, you can generate the files there:

docs/build.novella
template \"mkdocs\"\n\ndef api_pages = {\n  \"SomeClass\": \"my_module.SomeClass\",\n  # ...\n}\n\naction \"mkdocs-update-config\" {\n  site_name = \"My module\"\n  profile = \"readthedocs\"\n  update_with config -> {\n    def items = []\n    for title, package in api_pages.items():\n      items.append({ title: 'api/{}.md'.format(package) })\n    config['nav'].append({ 'API Documentation': items })\n  }\n}\n\naction \"preprocess-markdown\" {\n  use \"pydoc\"\n}\n\ndo\n  name: \"generate-api-pages\"\n  closure: {\n    # Make sure that this action runs before the Markdown preprocessors.\n    precedes \"preprocess-markdown\"\n  }\n  action: {\n    for title, package in api_pages.items():\n      def path = directory / 'content' / 'api' / (package + '.md')\n      path.parent.mkdir(parents=True, exist_ok=True)\n      path.write_text('---\\ntitle: {}\\n---\\n@pydoc {}\\n'.format(title, package))\n  }\n
"},{"location":"usage/yaml/","title":"YAML Configuration","text":""},{"location":"usage/yaml/#yaml-configuration","title":"YAML Configuration","text":"

Pydoc-Markdown can be configured with using via a YAML file. By default, the CLI will look for a file called pydoc-markdown.yaml (or .yml) in the current working directory. (Note that the configuration is not read from file when using the -m,--module, -p,--package and other options that are intended for invoking Pydoc-Markdown without a configuration file).

Tip: The --bootstrap and --bootstrap-mkdocs options can be used to write a template configuration file.

If you use the YAML configuration, the configuration file is pre-processed with a YTT-like templating language (see YAML Preprocessing).

The configuration contains of four main sections:

"},{"location":"usage/yaml/#yaml-example","title":"YAML Example","text":"
loaders:\n- type: python\n  search_path: [../src]\nrenderer:\n  type: mkdocs\n  pages:\n  - title: API Documentation\n    name: index\n    contents:\n    - school.*\n
"},{"location":"usage/yaml/#pyproject-example","title":"PyProject Example","text":"
[[tool.pydoc-markdown.loaders]]\ntype = \"python\"\nsearch_path = [ \"../src\" ]\n\n[tool.pydoc-markdown.renderer]\ntype = \"mkdocs\"\n\n[[tool.pydoc-markdown.renderer.pages]]\ntitle = \"API Documentation\"\nname = \"index\"\ncontents = [ \"school.*\" ]\n
"},{"location":"usage/yaml/#yaml-preprocessing","title":"YAML Preprocessing","text":"

New in Pydoc-Markdown 3.3.0. See also pydoc_markdown.util.ytemplate

Pydoc-Markdown performs very basic pre-processing on the YAML configuration before it is deserialized. The format is similar to that of YTT, but supports only a subset of the features and logic is interpreted as actual Python code.

Supports preprocessing features:

Check out the Read the Docs/Hugo baseURL documentation for an example.

"},{"location":"usage/yaml/#loaders","title":"Loaders","text":"

Loaders are configured in the $.loaders section of the Pydoc-Markdown configuration file. The key must be a list of loader definitions. Currently there is only the Python Loader.

Example:

loaders:\n- type: loadertype1\n  key: value\n- type: loadertype2\n

If no loaders are specified, the Python loader is used by default.

"},{"location":"usage/yaml/#processors","title":"Processors","text":"

Similar to the Loaders, the $.processors section expects a list of processor definitions. If no processors are defined, the filter, smart and crossref processors are used (in that order). Many processors do not have any additional options.

Example:

processors:\n- type: filter\n  documented_only: false\n- type: smart\n- type: crossref\n
"},{"location":"usage/yaml/#renderer","title":"Renderer","text":"

The $.renderer defines the renderer to use when running pydoc-markdown without arguments. Some renderers support the --server option, which allows a live-preview of the documentation. The default renderer is the Markdown renderer which will print the result to the terminal.

Other renderers may produce files on disk in a layout that conforms with the static site generator that they aim to support.

Example:

renderer:\n  type: mkdocs\n  pages:\n  - title: API Documentation\n    name: index\n    contents:\n    - school.*\n
"},{"location":"usage/yaml/#hooks","title":"Hooks","text":"

Example:

hooks:\n  pre-render:\n  - generate-changelog >docs/CHANGELOG.md\n

Allows you to specify shell commands that will be execute before or after the render step.

Available keys

"},{"location":"usage/yaml/#testing-your-configuration","title":"Testing your Configuration","text":"

You can test the configuration of your loaders using the pydoc-markdown --dump option. Combine this with docpspec -m --dump-tree to get a full formatted list tree of all API objects that Pydoc-Markdown has discovered, after applying all processors. You can disable processors by adding the --without-processors function.

$ pydoc-markdown --dump | docspec -m --dump-tree\nmodule school._class\n| class Class\n| | data topic\n| | data teacher\nmodule school._person\n| class Person\n| | data name\n| | data age\nmodule school._pupil\n| class Pupil\n[ ... ]\n
"}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 521c2e5d..4b60034d 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ