Skip to main content

Style your documents - convert Markdown files and GitHub issues into styled PDF documents in your corporate skin.

Project description

📄 docskin

Build Status image Security Status Ruff PyPI Version

Style your documents - convert Markdown files and GitHub issues into styled PDF documents in your corporate skin – with full support for CSS themes, logos, and directory processing.

🔧 Installation

uv sync

or in development mode:

uv sync --editable .

🚀 Usage

📁 Convert Markdown Files in a Directory

Converts all .md files in a directory to PDF format.

docskin md-dir \
  --input ./docs \
  --output ./pdfs \
  --css-style assets/markdown-dark.css \
  --logo assets/bosch-logo.png

📄 Convert a Single Markdown File

Converts a single file to PDF format.

docskin md \
  --input README.md \
  --output README.pdf \
  --css-style assets/minimal.css

🐙 Convert GitHub Issue to PDF

Converts a GitHub issue (e.g. on Bosch DevCloud) to PDF.

docskin github \
  --repo aos-stakeholder-tools/recompute-driving-cluster \
  --issue 197 \
  --api-base https://github.boschdevcloud.com/api/v3 \
  --output issue-197.pdf \
  --css-style assets/markdown-dark.css

🎨 Styling

Use any CSS file to define the appearance of the resulting PDFs.

Example styles:

  • assets/markdown-dark.css – GitHub Dark Theme
  • assets/minimal.css – Simple light theme
  • assets/bosch.css – Bosch Corporate Design (experimental)

🖼️ Logo (optional)

Add a logo at the top of the PDF with --logo path/to/logo.png.

📦 CLI Overview

The docskin CLI provides the following commands:

  • setup Installs all required Python and system dependencies for docskin, including WeasyPrint and its Linux libraries. Example:

    docskin setup
    
  • md Converts a single Markdown file to a styled PDF. Uses the MarkdownHTMLExtractor for parsing, StyleManager for HTML/CSS rendering, and WeasyPrint for PDF export. Example:

    docskin md --input README.md --output README.pdf --css-style assets/minimal.css
    
  • md-dir Recursively converts all Markdown files in a directory (and subdirectories) to PDFs, preserving the folder structure. Example:

    docskin md-dir --input ./docs --output ./pdfs --css-style assets/markdown-dark.css
    
  • github Fetches a GitHub issue and converts it to a styled PDF. Supports custom API endpoints and authentication for private repos. Example:

    docskin github --repo owner/repo --issue 42 --output issue-42.pdf --css-style assets/markdown-dark.css
    

💡 Notes

  • GitHub APIs use .netrc for authentication (if private repos).
  • For Bosch internal: Use --api-base https://github.boschdevcloud.com/api/v3

📜 License and Third-Party Software

docskin is licensed under the MIT License – see LICENSE.txt for details.

This software uses WeasyPrint for PDF rendering.
WeasyPrint is licensed under the BSD 3-Clause License, and depends on system libraries such as Cairo, Pango, HarfBuzz, GDK-Pixbuf, and GLib, which are licensed under the LGPL or MIT licenses.

Some CSS files in assets/ are adapted from
sindresorhus/github-markdown-css,
which is licensed under the MIT License.

The file assets/github.svg.png is adapted from Primer Octicons, which is licensed under the MIT License.

The full license texts for docskin and the bundled third-party components are included in the LICENSE.txt file in this repository.

�️ Updated File Structure

docskin/
├── cli.py                # CLI entry point (Click commands: setup, md, md-dir, github)
├── converter.py          # MarkdownHTMLExtractor, MarkdownPdfRenderer, orchestration
├── github_api.py         # GitHub issue fetching
├── styles.py             # StyleManager: CSS loading & HTML rendering
├── setup.py              # Dependency installation logic
assets/
├── markdown-dark.css     # GitHub Dark Theme CSS [3rd party](https://github.com/sindresorhus/github-markdown-css)
├── markdown-light.css    # GitHub Light Theme CSS [3rd party](https://github.com/sindresorhus/github-markdown-css)
├── minimal.css           # Minimal light theme CSS
tests/
├── resources/
│   ├── markdown/         # Test Markdown files
├── test_cli.py           # CLI integration tests

Architecture

The architecture of docskin is designed to be modular and extensible. The main components are:

docskin architecture

  • CLI: The command-line interface for user interaction.
  • MarkdownHTMLExtractor: Extracts HTML from Markdown files.
  • StyleManager: Manages CSS styles and applies them to the HTML.
  • PDFExporter: Handles the conversion of styled HTML to PDF.
  • GitHubIssueFetcher: Fetches GitHub issues for conversion.

🛠️ TODO / Ideas

  • PDF metadata (author, title, etc.)
  • Generate TOC
  • Bundle multiple issues
  • Integrate Highlight.js

Made with ❤️ by a senior engineer passionate about open source.

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

docskin-0.3.0.tar.gz (75.3 kB view details)

Uploaded Source

Built Distribution

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

docskin-0.3.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file docskin-0.3.0.tar.gz.

File metadata

  • Download URL: docskin-0.3.0.tar.gz
  • Upload date:
  • Size: 75.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for docskin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 232d7b5e36f3cfc56e6f43bfb2d53182ec95597fa942eaea8b83afbc9df6bad8
MD5 b20a5a578948047973079ac3e464a9dd
BLAKE2b-256 d16f8610d8fa442122a464ce70e79926bdc9affddc06ad8c23b344672efd9cc4

See more details on using hashes here.

File details

Details for the file docskin-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: docskin-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for docskin-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a8d702b49e9623eaae2b4bff62d136b6d88da7dda5d6c7343778bb200561dfd
MD5 aab1e50aceda17f05c21fd8965984f93
BLAKE2b-256 629b5b0dd8e3739f1633d6d49df9ed263634829e8d81b465b205b98817541960

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