Skip to main content

codeDown

PyPI version Python versions License: MIT Build Status Docs

codeDown is a simple yet powerful CLI tool that converts Markdown (.md) files into beautiful themed PDFs — complete with syntax-highlighted code blocks.

Built for developers who love clean documentation, readable code snippets, and automated workflows.


Features

  • Direct filenames – code-down notes.md or code-down notes
  • Shell Autocomplete – run code-down --install-completion from Bash, Zsh, or Fish
  • Syntax Highlighting for code blocks
  • Selectable Themes – interactive picker or CLI flag (light, dark, print, dracula, nord, solarized, github, gruvbox)
  • PDF Layout – print theme, page sizes, fonts, contents, headers, and metadata
  • Browser Preview – live Markdown editing, code-copy buttons, and resizable split views
  • Watch Mode – auto-regenerate PDF on file save
  • Self-Update – update from the CLI (code-down update)
  • Configurable – set a default theme via code-down config set-theme
  • Fast & Lightweight – converts Markdown to PDF in seconds

Installation

Via pip

pip install code-down

Via binary (Linux)

  1. Download the latest release Visit the Releases Page and download the Linux x86_64 binary (code-down-linux-x86_64).

  2. Make it executable and move to PATH

    chmod +x code-down-linux-x86_64
    sudo mv code-down-linux-x86_64 /usr/local/bin/code-down
    

Usage

Convert a Markdown file into a themed PDF:

code-down input.md output.pdf -s dark

Watch mode

Automatically rebuild the PDF when the Markdown file changes:

code-down -w input.md

Browser preview

code-down preview notes.md -s nord
code-down notes.md --preview
code-down preview notes.md --no-open --port 8080

Choose side-by-side, stacked, preview-only, or editor-only views. Drag the split divider or use its arrow keys; double-click it to reset. Copy individual code blocks with Copy code, or the whole document with Copy Markdown. Use Download preview to export a PDF with your current browser edits and selected theme, including configured PDF layout settings and local images. Browser edits do not change your source file. External file changes refresh the preview automatically when there are no browser edits. Use Reload file to replace browser edits with the file. Press Ctrl+C in the terminal to stop.

Options

Flag Description Default
-o, --output Output PDF file path Same as input with .pdf extension
-s, --style Theme style (light, dark, print, dracula, nord, solarized, github, gruvbox) Config default or dark
--preview Open the browser preview workspace
-w, --watch Watch file and rebuild PDF on changes
-v, --version Print version and exit

Commands

Command Description
code-down preview input.md Open the live preview workspace
code-down themes Pick a theme interactively (sets as default)
code-down config show Show current configuration
code-down config set-theme Set the default theme (interactive or by name)
code-down update Update codeDown to the latest version

Examples

Quick test file:

code-down examples/example.md

Convert README.md to README.pdf using the default theme:

code-down README.md

Convert with a dark theme and custom output name:

code-down README.md -o README_dark.pdf -s dark

Watch a file and rebuild on every save:

code-down -w notes.md -s light

Pick a theme interactively:

code-down themes

Notes

  • Ensure your Markdown files are UTF-8 encoded for best results.
  • Supports syntax highlighting for most major programming languages.
  • Works completely offline — no internet connection required (except for update).

Autocomplete and filename shortcuts

code-down notes                # resolves notes.md
code-down "my notes.md"        # paths with spaces
code-down --install-completion # run from Bash, Zsh, or Fish; restart the shell

Completion suggests commands, Markdown files, directories, options, and themes. Use code-down --show-completion to inspect the generated shell script.

Autocomplete also covers preview filenames and options, all eight themes, page sizes, configuration keys, and matching setting values:

code-down preview notes.md --style <Tab>
code-down notes.md --page-size <Tab>
code-down config set <Tab>
code-down config set wrap_code <Tab>

Upgrade to 3.0.1 and refresh completion:

python -m pip install --upgrade code-down
code-down --install-completion

PDF layout and project defaults

code-down notes.md -s print --page-size Letter --margin 15mm --page-numbers \
  --toc --header "Project notes" --title "Guide" --author "Your name"
code-down notes.md --no-overwrite

Local images resolve relative to the input file. Watch mode handles replacement saves and local resource changes, and failed renders preserve the previous PDF. See code-down convert --help for fonts, code wrapping, headers, and footers.

A nearest ancestor codedown.toml can supply validated project defaults:

default_theme = "print"
page_size = "A4"
margin = "20mm"
page_numbers = true

CLI options override project settings, which override user settings and built-in defaults. Use code-down config set margin 15mm for a user default and code-down config show to inspect settings. Existing PDFs are overwritten by default; --no-overwrite refuses an existing output without prompting.

Development and checks

python -m pip install -e '.[dev]'
python -m pytest -q
python -m build

Tests include real PDFs, completion requests, watch events, verified updates, and wheel contents. CI tests Python 3.9, 3.12, and 3.14 before release publication. Standalone releases include SHA-256 verification and retain a backup on update.

Metadata

Release files for code-down 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for code-down 3.0.1
File Size Uploaded Provenance Actions
code_down-3.0.1.tar.gz 33.9 kB Without provenance Details for code_down-3.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for code-down 3.0.1
File Interpreter ABI Platform Actions
code_down-3.0.1-py3-none-any.whl Python 3 none any Details for code_down-3.0.1-py3-none-any.whl

Total release size: 66.8 kB

Release files / code_down-3.0.1.tar.gz

Download URL code_down-3.0.1.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f0539fb552882b312b2e9977e33144364882eb33a19df158fc6744c019f4d024
BLAKE2b-256 checksum
How to use checksums
05140c91237523faafd743be62d06e995f5507a9ebefc79165598ad168bff291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / code_down-3.0.1-py3-none-any.whl

Download URL code_down-3.0.1-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5613d7a161b87113c81bfb0b5827edd414779d6de6f914a1d02111a95e7b20b
BLAKE2b-256 checksum
How to use checksums
a1622499e8c7f124f39e788a4c39c9c79764098b1fa8feecc826a390ca727e28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for code-down 3.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page