Skip to main content

Generates a professional PDF source code annex with Smart Index, Images and Emoji support.

Project description

📂 codeannex

Generates a professional PDF annex from a project's source code — with syntax highlighting, a hierarchical table of contents, image rendering, and intelligent font discovery.

🚀 Key Features

  • Interactive Wizard — Run without arguments to configure your PDF step-by-step. It intelligently skips irrelevant questions (like starting page if numbering is disabled).
  • Intelligent Font Discovery — Automatically finds and registers fonts from your system (Windows, Linux, macOS) by name (e.g., --title-font "Play").
  • Fully Customizable UI — Change every label, color, and size via CLI. Default labels are in English for international consistency.
  • Hierarchical Summary — Real tree-structured Table of Contents with terminal-like connection lines.
  • Customizable Primary Color — Set the theme color for headers, folder icons, and accents with --primary-color.
  • Smart Contrast — Automatically switches header text between black and white based on the brightness of your primary color for maximum legibility.
  • Flexible Page Styling — Support for custom page background and code block colors.
  • Git-Aware — Perfectly interprets .gitignore using Git's native engine.

🛠 Installation

pip install codeannex

📖 Usage

Interactive Mode (Wizard)

Simply run without arguments to start the step-by-step configuration:

codeannex .

Automation / CI

Use the --no-input flag to disable the wizard in automated environments:

codeannex . --no-input

Professional Customization Example

python3 -m codeannex . \
  --cover-title "Anexo I" \
  --no-page-numbers \
  --primary-color "#0f4761" \
  --title-font "Play" --title-size 20 \
  --normal-font "Times New Roman" --normal-size 12 \
  --margin-top 2.5 --margin-bottom 2.5 --margin-left 3 --margin-right 3 \
  --code-bg "#f5f5f5" --code-size 9

⚙️ Configuration Options

Document & Labels

  • --cover-title TITLE — Title for the cover (default: "ANEXO TÉCNICO").
  • --cover-subtitle SUB — Subtitle for the cover.
  • --summary-title TITLE — Title for the summary page.
  • --repo-label LABEL — Prefix for repository link (default: "Repository: ").
  • --project-label LABEL — Prefix for project name in footer.
  • --file-part-format FMT — Format for file parts (default: "({current}/{total})").
  • --no-input — Disable the interactive wizard.

Colors & Themes

  • --primary-color HEX — Main color for headers and accents.
  • --page-bg-color HEX — Background color for all pages.
  • --code-bg HEX — Background color for code blocks.
  • --normal-color HEX / --title-color HEX — Text colors.

Fonts & Sizes

  • --title-font / --subtitle-font / --normal-font — System font names.
  • --mono-font — Font for code (e.g., "Consolas", "Ubuntu Mono").
  • --emoji-font — Font for emojis (e.g., "Noto Emoji").
  • --code-size N — Font size for code blocks.

Layout

  • --margin CM — General margin for all sides.
  • --margin-top, --margin-bottom, --margin-left, --margin-right — Specific margins in cm.
  • --no-page-numbers — Disable page numbering.

🧪 Testing

PYTHONPATH=. pytest

📄 License

MIT

Project details


Download files

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

Source Distribution

codeannex-0.2.0.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

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

codeannex-0.2.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file codeannex-0.2.0.tar.gz.

File metadata

  • Download URL: codeannex-0.2.0.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codeannex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a9259e869b238ad50ae878627b90f9b2df3cf093d0a2d175ff272d57393a0da0
MD5 4c784d4950f9992a28faf92a2ca8c87c
BLAKE2b-256 6962199b7b2aec7feef760c7ea839037aef738dae2e46ed9b63235de1aa2b375

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeannex-0.2.0.tar.gz:

Publisher: publish.yml on tanhleno/codeannex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codeannex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: codeannex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codeannex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f82f15a655fdfa49a0a5eca11387f55610f6718da68e40890e5a2daf72d7cf95
MD5 fe6ba79a82fbc0b030792970cc5bc06b
BLAKE2b-256 4964e929e7e99e69fa8892ab8e81e021727fa76f9bfe17ebe7b20ea11daede4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeannex-0.2.0-py3-none-any.whl:

Publisher: publish.yml on tanhleno/codeannex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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