Nexus is a command-line tool for converting markdown documents to professionally styled PDFs. It's designed for creating consistent, high-quality documentation from simple markdown files.
- Convert single markdown files or batch process directories
- Customize output with templates and configuration
- Professional document styling with headers, footers, and metadata
- Support for tables, code blocks, and other markdown features
- Configurable page size, margins, and styling options
- Python 3.8 or higher
- wkhtmltopdf (required by pdfkit)
git clone https://github.com/y0anfa/nexus.git
cd nexus
pip install .nexus initThis creates a config.yaml file with default settings that you can customize.
nexus convert --input document.md --output document.pdfnexus batch-convert --input-dir docs/ --output-dir output/Nexus can be configured using a YAML file. Create a default config file with:
nexus init --output my-config.yamlExample configuration:
company: "Your Company"
logo: "path/to/logo.png"
version: "1.0.0"
date: "2023-05-01"
author: "John Doe"
approved_by: "Jane Smith"
comments: "Draft document"
title: "Document Title"
pdf_options:
page-size: "A4"
margin-top: "0.75in"
margin-right: "0.75in"
margin-bottom: "0.75in"
margin-left: "0.75in"Nexus uses Jinja2 templates for styling PDFs. You can create custom templates or use the built-in templates.
To use a custom template:
nexus convert --input document.md --output document.pdf --template my-template.htmlTemplates are HTML files with Jinja2 templating. Available variables:
content: The HTML content converted from markdowncompany: Company name from configlogo: Path to logo from configversion: Document version from configdate: Document date from configauthor: Author name from configapproved_by: Approver name from configcomments: Additional comments from configtitle: Document title from config
--help: Show help message--version: Show version information
Convert a single markdown file to PDF.
nexus convert --input FILE --output FILE [OPTIONS]Options:
--input,-i: Path to the input markdown file (required)--output,-o: Path to the output PDF file (required)--template,-t: Path to a custom template file--config,-c: Path to a config file--save-html: Save intermediate HTML file for debugging
Convert all markdown files in a directory to PDFs.
nexus batch-convert --input-dir DIR --output-dir DIR [OPTIONS]Options:
--input-dir,-i: Directory containing markdown files (required)--output-dir,-o: Directory for output PDF files (required)--template,-t: Path to a custom template file--config,-c: Path to a config file--save-html: Save intermediate HTML files for debugging--pattern,-p: Glob pattern to match markdown files (default: *.md)
Initialize a new configuration file with default settings.
nexus init [OPTIONS]Options:
--output,-o: Path to save the config file (default: config.yaml)
git clone https://github.com/yourusername/nexus.git
cd nexus
pip install -e ".[dev]"pytestContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.