-
Run downdoc from the CLI within your virtual environment
-
Use PyPI as the single installation location of your Python project tooling
-
Use the API to convert files using your own Python code/scripts
-
Use the Hatch plugin to convert your project’s README.adoc file to Markdown (or any other PyPI supported README format), when building your package
uvx --from Pydowndoc-bin -- downdoc --version|
Tip
|
uv will warn you that the downdoc binary is not directly provided by the Pydowndoc[bin] package, so we suggest to use --from Pydowndoc-bin when running downdoc using uvx or uv tool.
|
uv add Pydowndoc[bin]uv tool install Pydowndoc-binpath/to/venv/python -m pip install Pydowndoc[bin]Pydowndoc assumes by default that you wish to use the downdoc binary already installed on your system (E.g. using your system’s package manager).
Installing the PyPI package Pydowndoc will only install the Python compatibility layer for downdoc.
[bin] extra on a system where downdoc is not already installed will not work$ uvx --with Pydowndoc python -c "import pydowndoc; pydowndoc.get_help()"
OSError: The downdoc executable could not be found. Ensure it is installed (E.g `uv add Pydowndoc[bin]`).|
Warning
|
These commands will only work correctly after the |
downdoc --versiondowndoc --help.md)downdoc MyNotes.adocdowndoc MyNotes.adoc -o path/to/output.mddowndoc MyNotes.adoc -o -cat MyNotes.adoc | downdoc - -o MyNotes.md.md)from pathlib import Path
import pydowndoc
pydowndoc.convert_file(Path("MyNotes.adoc"))from pathlib import Path
import pydowndoc
pydowndoc.convert_file(Path("MyNotes.adoc"), output_location=Path("path/to/output.md"))from pathlib import Path
import pydowndoc
converted_file_content: str = pydowndoc.convert_file(
Path("MyNotes.adoc"), output_location=pydowndoc.OUTPUT_CONVERSION_TO_STRING,
)from pathlib import Path
import pydowndoc
original_content: str = ...
converted_content: str = pydowndoc.convert_string(original_content)from pathlib import Path
import pydowndoc
from pydowndoc.conversion_backends import PandocMultiMarkdownConversionBackend
pydowndoc.convert_file(Path("MyNotes.adoc"), backend=PandocMultiMarkdownConversionBackend)import pydowndoc
version_string: str = pydowndoc.get_version()|
Tip
|
This project includes function docstrings and modern type annotations, allowing you to search for API functionality using your IDE or any program with Python LSP support. |
-
Ensure the
readmefield is added to yourproject.dynamiclist within yourpyproject.tomlfile[project] name = "my-cool-project" version = "0.1.0" dynamic = ["readme"]
-
Set up your build backend, within your
pyproject.tomlfile, addingPydowndoc[bin]as a build dependency[build-system] build-backend = "hatchling.build" requires = ["hatchling", "Pydowndoc[bin]"]
TipTo prevent issues with users building your package that may not have the downdocbinary already installed on their system, we suggest including the[bin]extra in your package’s build dependencies. -
Include the hook name within
[tool.hatch.metadata.hooks]to enable README-file conversion[tool.hatch.metadata.hooks.downdoc-readme]
or
[tool.hatch.metadata.hooks] downdoc-readme = {}
-
Using a path to a custom README file
[tool.hatch.metadata.hooks.downdoc-readme] path = "README2.adoc"
-
Using an alternative conversion backend
[tool.hatch.metadata.hooks.downdoc-readme] backend = "pandoc-md-mmd"
-
A full example of a pyproject.toml file
[project]
name = "my-cool-project"
version = "0.1.0"
dynamic = ["readme"]
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "Pydowndoc[bin]"]
[tool.hatch.metadata.hooks.downdoc-readme]
path = "README2.adoc"
backend = "pandoc-md-mmd"| Option | Type | Default | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
The location of the AsciiDoc file to be converted to Markdown and used as the project’s README file |
||||||||||||
|
|
|
The conversion backend used to convert from AsciiDoc to any other PyPI supported README format. Supported Conversion Backends
|
uv tool upgrade Pydowndoc-binuv sync --upgrade-package Pydowndocpath/to/venv/python -m pip install --upgrade Pydowndocuv remove Pydowndocuv tool uninstall Pydowndoc-binpath/to/venv/python -m pip uninstall PydowndocIf there are issues with the Python API for this package, or you are encountering installation problems, please report these on the GitHub issues tracker for this project.
If you have problems with the conversion process of your AsciiDoc files to Markdown, please report these upstream, directly to the downdoc project.
Windows and macOS wheels are provided to enable use of this project on non-linux hosts. However, these versions have not had the same level of testing as the linux version. Therefore, if you encounter any bugs with these other versions, report them on the GitHub issues tracker for this project.
The compiled binary of the distributed downdoc software is shared under the MIT licence as described in the upstream project’s licence file.
All other code in this project is distributed under the Apache-2.0 licence.