Skip to main content

Convert Markdown to polished documents with reusable themes

Project description

DocuCraft

Stop writing PDFs by hand. Write Markdown, get a polished document.

import docu_craft

docu_craft.render("report.md", theme="scholar")

What it does

You write content in Markdown. DocuCraft handles everything else:

  • Picks a theme — fonts, colors, margins, tables, code blocks, all styled consistently
  • Validates structure — checks that your document has the sections it needs before rendering
  • Handles emoji — replaces emoji characters with proper PNG images in the PDF
  • Finds your assets — themes, skeletons, and emoji sets from the package, your home folder, or any mounted path

No more pasting CSS into scripts. No more fighting with PDF libraries. No more weasyprint.HTML(string=html, base_url='.').write_pdf(...) every time.


Install

pip install docu_craft

# with ReportLab support
pip install "docu_craft[reportlab]"

# everything
pip install "docu_craft[all]"

Themes

Built-in themes, ready to use:

Theme Best for
scholar Academic articles, PhD documents
handout Course materials, workshops
tech-doc API docs, technical references
official Institutional letters, formal reports
docu_craft.render("thesis.md", theme="scholar")
docu_craft.render("class_notes.md", theme="handout")

Drop your own theme in ~/docu_craft/themes/mytheme/style.css and use it the same way.


Skeletons

Skeletons define what sections a document should have. DocuCraft tells you if something is missing before you render.

doc = docu_craft.Document("thesis.md")
doc.apply_skeleton("academic_article").validate()  # raises if Introducción or Conclusiones missing
doc.render()

Built-in skeletons: academic_article, plan_trabajo, tech_doc, official_letter, course_handout.

Write your own in YAML or as a Python class with custom validation logic.


Emoji in PDFs

PDF fonts don't render emoji. DocuCraft swaps them for PNG images automatically.

docu_craft.render("notes.md", theme="scholar", emoji_set="twemoji")

Two sets ship with the package: noto-minimal (60 common emoji, Apache 2.0) and twemoji (3800+ emoji, CC-BY 4.0). Download more:

python -m docu_craft.emoji.downloader twemoji
python -m docu_craft.emoji.downloader noto

Config layers

Set defaults once, override whenever you need:

# ~/docu_craft/config.yaml — your personal defaults
defaults:
  theme: scholar
  emoji_set: twemoji
# .docu_craft.yaml — per-project overrides
defaults:
  theme: handout
---
theme: official
---
# Per-document frontmatter overrides everything above
# Explicit argument wins over all of the above
docu_craft.render("file.md", theme="tech-doc")

Extended storage

Point DocuCraft at any folder — a team share, a mounted drive, a network path. It searches all of them for themes, skeletons, and emoji sets.

docu_craft.add_extended_store("/mnt/team/docu_craft-assets", name="team")
docu_craft.add_extended_store("G:/Shared/styles", name="gdrive")

Or declare it in .docu_craft.yaml:

extended_stores:
  - /mnt/team/docu_craft-assets
  - path: G:/Shared/styles
    name: gdrive

Pluggable renderers

docu_craft.register_renderer(
    format="pdf",
    module_path="mypackage.renderer:MyRenderer",
    engine="myengine",
    package="mypackage",
    install="pip install mypackage",
)

doc.render(format="pdf", engine="myengine")
Format Engine Status
PDF weasyprint
PDF reportlab 🚧 WIP

License

Apache 2.0 © Christian A. Servin Lozano

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

docu_craft-0.1.0.tar.gz (357.5 kB view details)

Uploaded Source

Built Distribution

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

docu_craft-0.1.0-py3-none-any.whl (475.4 kB view details)

Uploaded Python 3

File details

Details for the file docu_craft-0.1.0.tar.gz.

File metadata

  • Download URL: docu_craft-0.1.0.tar.gz
  • Upload date:
  • Size: 357.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for docu_craft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4c41a6ae4b8eac0a86ddd251a9697a167cd7679246226e08e27c3b42ed4c69e1
MD5 a8c0eb4a99f609281e79afdc7a9c12c7
BLAKE2b-256 c39dec4d45900f7bdd3ff84e8c874af75dcc51abc05ce83e20b24ffacbc51870

See more details on using hashes here.

Provenance

The following attestation bundles were made for docu_craft-0.1.0.tar.gz:

Publisher: publish.yml on CServinL/docu-craft

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

File details

Details for the file docu_craft-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: docu_craft-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 475.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for docu_craft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c4c4c6172b8b8b6ba45de33704bb27a73a13500d7b5771bc10cee9ad9b1703
MD5 4d5541f3b8f29d89612c3615f5463aba
BLAKE2b-256 4c9edeb879e7c6af71cbc87c33dbc52aa587fa1be56a99f68ebd93c99461be03

See more details on using hashes here.

Provenance

The following attestation bundles were made for docu_craft-0.1.0-py3-none-any.whl:

Publisher: publish.yml on CServinL/docu-craft

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