Skip to main content

Python wrapper for converting/reducing AsciiDoc files back to Markdown.

Project description

Pydowndoc

Pydowndoc PyPI Version Python Version downdoc Version Tests Status mypy Status Ruff uv

Rapidly convert your AsciiDoc files to Markdown, using Python

A Python wrapper around the latest-built binary of downdoc; a rapid AsciiDoc to Markdown converter.

Features

Installation

Run as a uv tool (no installation necessary)

uvx --from Pydowndoc -- downdoc --version

Add to your uv project/script’s dependencies

uv add Pydowndoc

Install permenantly as a uv tool

uv tool install Pydowndoc

Install using pip after creating a virtual environment

path/to/venv/python -m pip install Pydowndoc

CLI Usage

These commands will only work correctly either after installation as a permenant uv tool, or after activating a virtual environment with Pydowndoc installed. Replace the command name downdoc with uvx --from Pydowndoc -- downdoc, to run any of the following commands in an ephemeral envrionment.

Get the currently installed version

downdoc --version

Output the help message

downdoc --help

Convert a given file (filename will be kept the same, with .md file-extension)

downdoc MyNotes.adoc

Output the converted file to the given filename

downdoc MyNotes.adoc -o output.md

Output the converted file to stdout

downdoc MyNotes.adoc -o -

Read the input AsciiDoc file from stdin

cat MyNotes.adoc | downdoc - -o MyNotes.md

API Usage

Convert a given file (the filename will be kept the same, with a .md file-extension)

from pathlib import Path

import pydowndoc

pydowndoc.run(Path("MyNotes.adoc"))

Retrieve the converted file as a string

from pathlib import Path

import pydowndoc

converted_file_contents: str = pydowndoc.run(
    Path("MyNotes.adoc"),
    output="-",
    process_capture_output=True,
).stdout.decode()

Ensure the conversion process executes successfully

from pathlib import Path

import pydowndoc

pydowndoc.run(
    Path("MyNotes.adoc"),
    output=Path("output.md"),
    process_check_return_code=True,
)

Use as a Hatch build hook

  1. Ensure the readme field is added to your project.dynamic list within your pyproject.toml file

    [project]
    name = "my-cool-project"
    version = "0.1.0"
    dynamic = ["readme"]
    
  2. Set up your build backend, within your pyproject.toml file

    [build-system]
    build-backend = "hatchling.build"
    requires = ["hatchling", "Pydowndoc"]
    
  3. Include the hook name, so that processing ocurrs

    [tool.hatch.metadata.hooks.downdoc-readme]
    

    or

    [tool.hatch.metadata.hooks]
    downdoc-readme = {}
    
    1. Using a path to a custom README file

      [tool.hatch.metadata.hooks.downdoc-readme]
      path = "README2.adoc"
      
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"]

[tool.hatch.metadata.hooks.downdoc-readme]
path = "README2.adoc"

Configuration Options

Option Type Default Description
path str README.adoc The location of the file to convert to Markdown, to be used as the project’s README file

Upgrading

If installed as a uv tool

uv tool upgrade Pydowndoc

If added as a uv project dependency

uv sync --upgrade-package Pydowndoc

If installed using pip

path/to/venv/python -m pip install --upgrade Pydowndoc

Uninstallation

If added as a uv project dependency

uv remove Pydowndoc

If installed as a uv tool

uv tool uninstall Pydowndoc

If installed with pip

path/to/venv/python -m pip uninstall Pydowndoc

Reporting Issues

If there are issues with the Python API for this package, or you are encountering installation problems, please report these to 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 & macOS Wheels

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 to the GitHub issues tracker for this project.

Licencing

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 distrubuted under the Apache-2.0 licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydowndoc-1.1.1-py3-none-win_amd64.whl (14.5 MB view details)

Uploaded Python 3Windows x86-64

pydowndoc-1.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_34_x86_64.whl (17.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

pydowndoc-1.1.1-py3-none-macosx_13_0_x86_64.whl (18.4 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

File details

Details for the file pydowndoc-1.1.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pydowndoc-1.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8902dd8258a539da996f3fc8624de3d138550aeb46dc27782fbc1a6c3391764c
MD5 dd6a132d98c8d68749dc05977e2241ca
BLAKE2b-256 cdb10786f6a5aaa4d1797375a0c86ab5345be1632b80d2f344f9e1bdb175dd3d

See more details on using hashes here.

File details

Details for the file pydowndoc-1.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pydowndoc-1.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 565f47fa0b9712e673abab6ed77e659ad8055c8af336167134d1a3242f244e21
MD5 0a7ceb9bb4c803ff1278715fb522a648
BLAKE2b-256 29ce9fb8d8616a8a23d3015447f299cf44dafb55ec99d5baaad1a5f4993cf710

See more details on using hashes here.

File details

Details for the file pydowndoc-1.1.1-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pydowndoc-1.1.1-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 6631cbdf5f9cfff01b77d194e678ba3bdbba70e3a1d4e7329a52b1126a97c603
MD5 33a29cb480190c073ae3eb5e6bd5eb7c
BLAKE2b-256 8072ee32adf895f6c6569113e56f75308d4148aa11786524f4d5df1ff044c1ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page