Skip to main content

Markdown to PDF converter using Pandoc and Typst

Project description

mark2pdf

基于 Pandoc 和 Typst 的 Markdown 转 PDF 工具

将 Markdown 文件转换为精美的 PDF。支持 Frontmatter 配置、自动化目录管理以及通过 Python 代码调用。

安装

pip install mark2pdf

注意:使用前请确保已安装 PandocTypst

CLI 使用

1. 初始化与配置

# 初始化工作区(创建配置和目录结构)
mark2pdf init

# 安装常用中文字体(如 lxgw-wenkai)
mark2pdf fonts install lxgw-wenkai

2. 转换文档

# 转换单个文件 (默认输出到 out/ 目录)
mark2pdf convert document.md

# 转换单个文件并指定输出文件名
mark2pdf convert document.md --output my-report

# 转换整个目录(自动合并目录内所有 md 文件)
mark2pdf convert --dir docs/

3. 更多功能

# 复制内置模板到本地 template/ 目录
mark2pdf template

Python API 使用

from mark2pdf import convert_file, convert_directory

# 1. 转换单个文件
# 将 input.md 转换为 output.pdf,使用默认配置
convert_file("input.md", output_file="output.pdf")

# 2. 转换目录
# 将 docs 目录下的所有 Markdown 合并转换为 merged_report.pdf
convert_directory("docs", output_file="merged_report.pdf")

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

yakultpdf-0.7.17.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

yakultpdf-0.7.17-py3-none-any.whl (277.1 kB view details)

Uploaded Python 3

File details

Details for the file yakultpdf-0.7.17.tar.gz.

File metadata

  • Download URL: yakultpdf-0.7.17.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for yakultpdf-0.7.17.tar.gz
Algorithm Hash digest
SHA256 25bb691c57cdcaec54c7840aed5d9f0e385a62991a3a90605dd05132b10fad4e
MD5 f96054fee1d824e68364e47d91df1b36
BLAKE2b-256 4f0abe45265d5bb06e6bad242e17a06be54c535a7496dc091378f77051c42ea4

See more details on using hashes here.

File details

Details for the file yakultpdf-0.7.17-py3-none-any.whl.

File metadata

  • Download URL: yakultpdf-0.7.17-py3-none-any.whl
  • Upload date:
  • Size: 277.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for yakultpdf-0.7.17-py3-none-any.whl
Algorithm Hash digest
SHA256 27188ea5f8f746144ae8a8646ec43766cc037c9e5a9277470b47a587249ecac8
MD5 66e31c186b87b39e4d4890a089c1c7a9
BLAKE2b-256 84cd1b30f259d74cc0b4fda01c69cdea26d9f812fb85a48696e94c3428176954

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