md2pdf 0.6__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. md2pdf-2.0.0/.dockerignore +17 -0
  2. md2pdf-2.0.0/.github/pull_request_template.md +10 -0
  3. md2pdf-2.0.0/.github/workflows/chore.yml +42 -0
  4. md2pdf-2.0.0/.github/workflows/docker-images.yml +20 -0
  5. md2pdf-2.0.0/.github/workflows/docker-publish.yml +82 -0
  6. md2pdf-2.0.0/.github/workflows/package.yml +44 -0
  7. md2pdf-2.0.0/.github/workflows/quality.yml +81 -0
  8. md2pdf-2.0.0/.gitignore +21 -0
  9. md2pdf-2.0.0/.python-version +1 -0
  10. md2pdf-2.0.0/CHANGELOG.md +76 -0
  11. md2pdf-2.0.0/Dockerfile +47 -0
  12. md2pdf-2.0.0/Dockerfile.alpine +49 -0
  13. md2pdf-2.0.0/Makefile +69 -0
  14. md2pdf-2.0.0/PKG-INFO +230 -0
  15. md2pdf-2.0.0/README.md +196 -0
  16. md2pdf-2.0.0/assets/md2pdf-logo.png +0 -0
  17. md2pdf-2.0.0/examples/custom-styles-with-pygments.css +414 -0
  18. md2pdf-2.0.0/examples/custom-styles.css +152 -0
  19. md2pdf-2.0.0/examples/gutenberg-modern.min.css +6 -0
  20. md2pdf-2.0.0/examples/my-music.md.j2 +100 -0
  21. md2pdf-2.0.0/pyproject.toml +98 -0
  22. md2pdf-2.0.0/renovate.json +42 -0
  23. md2pdf-2.0.0/src/md2pdf/__init__.py +3 -0
  24. md2pdf-2.0.0/src/md2pdf/__main__.py +13 -0
  25. md2pdf-2.0.0/src/md2pdf/cli.py +26 -0
  26. md2pdf-2.0.0/src/md2pdf/conf.py +8 -0
  27. md2pdf-2.0.0/src/md2pdf/core.py +84 -0
  28. md2pdf-2.0.0/src/md2pdf/exceptions.py +7 -0
  29. md2pdf-2.0.0/tests/__init__.py +1 -0
  30. md2pdf-2.0.0/tests/assets/input.css +152 -0
  31. md2pdf-2.0.0/tests/assets/input.md +84 -0
  32. md2pdf-2.0.0/tests/defaults.py +8 -0
  33. md2pdf-2.0.0/tests/test_cli.py +68 -0
  34. md2pdf-2.0.0/tests/test_core.py +39 -0
  35. md2pdf-2.0.0/uv.lock +1045 -0
  36. md2pdf-0.6/MANIFEST.in +0 -8
  37. md2pdf-0.6/PKG-INFO +0 -33
  38. md2pdf-0.6/README.md +0 -159
  39. md2pdf-0.6/md2pdf/__init__.py +0 -8
  40. md2pdf-0.6/md2pdf/__main__.py +0 -41
  41. md2pdf-0.6/md2pdf/core.py +0 -51
  42. md2pdf-0.6/md2pdf/exceptions.py +0 -5
  43. md2pdf-0.6/md2pdf.egg-info/PKG-INFO +0 -33
  44. md2pdf-0.6/md2pdf.egg-info/SOURCES.txt +0 -21
  45. md2pdf-0.6/md2pdf.egg-info/dependency_links.txt +0 -1
  46. md2pdf-0.6/md2pdf.egg-info/entry_points.txt +0 -3
  47. md2pdf-0.6/md2pdf.egg-info/requires.txt +0 -3
  48. md2pdf-0.6/md2pdf.egg-info/top_level.txt +0 -2
  49. md2pdf-0.6/requirements-dev.txt +0 -12
  50. md2pdf-0.6/requirements.txt +0 -3
  51. md2pdf-0.6/setup.cfg +0 -26
  52. md2pdf-0.6/setup.py +0 -68
  53. md2pdf-0.6/tests/__init__.py +0 -0
  54. md2pdf-0.6/tests/defaults.py +0 -6
  55. md2pdf-0.6/tests/test_cli.py +0 -80
  56. md2pdf-0.6/tests/test_core.py +0 -31
  57. {md2pdf-0.6 → md2pdf-2.0.0}/LICENSE +0 -0
@@ -0,0 +1,17 @@
1
+ # Docker stuff
2
+ Dockerfile
3
+ Dockerfile.*
4
+ .dockerignore
5
+
6
+ # Git stuff
7
+ .git
8
+ .github
9
+ .gitignore
10
+
11
+ # Python stuff
12
+ .coverage
13
+ .mypy_cache
14
+ .pytest_cache
15
+ .python-version
16
+ .ruff_cache
17
+ .venv
@@ -0,0 +1,10 @@
1
+ ## Purpose
2
+
3
+ Description...
4
+
5
+ ## Proposal
6
+
7
+ Description...
8
+
9
+ - [ ] item 1...
10
+ - [ ] item 2...
@@ -0,0 +1,42 @@
1
+ name: Chore checks
2
+
3
+ on:
4
+ push:
5
+ branches-ignore: ["main"]
6
+ pull_request:
7
+ branches-ignore: ["main"]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ fixup-commits:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
18
+ with:
19
+ fetch-depth: 0
20
+ - name: Check absence of fixup commits
21
+ run: |
22
+ ! git log --pretty=format:%s | grep 'fixup!'
23
+
24
+ check-changelog:
25
+ runs-on: ubuntu-latest
26
+
27
+ steps:
28
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
29
+ with:
30
+ fetch-depth: 0
31
+ - name: Check that a CHANGELOG has been modified in the current branch
32
+ run: |
33
+ git diff --name-only origin/main | grep CHANGELOG
34
+
35
+ lint-changelog:
36
+ runs-on: ubuntu-latest
37
+
38
+ steps:
39
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
40
+ - name: Check CHANGELOG max line length
41
+ run: |
42
+ test $(cat CHANGELOG.md | grep -Ev "^\[.*\]: https://github.com/jmaupetit/data7" | wc -L) -le 80
@@ -0,0 +1,20 @@
1
+ name: Docker Image CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
17
+ - name: Build Docker (debian) image
18
+ run: make build-docker-debian
19
+ - name: Build Docker (alpine) image
20
+ run: make build-docker-alpine
@@ -0,0 +1,82 @@
1
+ name: Publish Docker image
2
+
3
+ on:
4
+ release:
5
+ types: ["published"]
6
+
7
+ jobs:
8
+ push_to_registry:
9
+ name: Push Docker image to Docker Hub
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ packages: write
13
+ contents: read
14
+ attestations: write
15
+ id-token: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
19
+
20
+ - name: Log in to Docker Hub
21
+ uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
22
+ with:
23
+ username: ${{ secrets.DOCKER_USERNAME }}
24
+ password: ${{ secrets.DOCKER_PASSWORD }}
25
+
26
+ - name: Install uv and set the python version
27
+ uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+ enable-cache: true
31
+
32
+ - name: Get python package release
33
+ id: version
34
+ run: echo "version=$(uv version --color never --short)" >> "$GITHUB_OUTPUT"
35
+
36
+ - name: Check package version used as tag
37
+ run: echo ${{ steps.version.outputs.version }}
38
+
39
+ - name: Extract metadata (tags, labels) for Docker
40
+ id: meta
41
+ uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
42
+ with:
43
+ images: jmaupetit/md2pdf
44
+ tags: ${{ steps.version.outputs.version }}
45
+
46
+ - name: Build and push Docker Debian image
47
+ id: push-debian
48
+ uses: docker/build-push-action@64c9b141502b80dbbd71e008a0130ad330f480f8
49
+ with:
50
+ context: .
51
+ file: ./Dockerfile
52
+ push: true
53
+ tags: |
54
+ jmaupetit/md2pdf:latest
55
+ jmaupetit/md2pdf:${{ steps.version.outputs.version }}
56
+ labels: ${{ steps.meta.outputs.labels }}
57
+
58
+ - name: Build and push Docker Alpine image
59
+ id: push-alpine
60
+ uses: docker/build-push-action@64c9b141502b80dbbd71e008a0130ad330f480f8
61
+ with:
62
+ context: .
63
+ file: ./Dockerfile.alpine
64
+ push: true
65
+ tags: |
66
+ jmaupetit/md2pdf:alpine
67
+ jmaupetit/md2pdf:${{ steps.version.outputs.version }}-alpine
68
+ labels: ${{ steps.meta.outputs.labels }}
69
+
70
+ - name: Generate artifact attestation (Debian)
71
+ uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
72
+ with:
73
+ subject-name: index.docker.io/jmaupetit/md2pdf
74
+ subject-digest: ${{ steps.push-debian.outputs.digest }}
75
+ push-to-registry: true
76
+
77
+ - name: Generate artifact attestation (Alpine)
78
+ uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
79
+ with:
80
+ subject-name: index.docker.io/jmaupetit/md2pdf
81
+ subject-digest: ${{ steps.push-alpine.outputs.digest }}
82
+ push-to-registry: true
@@ -0,0 +1,44 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: ["published"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release-build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
15
+ - name: Set up python/uv (with caching)
16
+ uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7
17
+ with:
18
+ enable-cache: true
19
+ - name: Install the project
20
+ run: uv sync --locked --all-extras --dev
21
+ - name: Build release distributions
22
+ run: uv build
23
+ - name: Upload dists
24
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
25
+ with:
26
+ name: release-dists
27
+ path: dist/
28
+
29
+ pypi-publish:
30
+ runs-on: ubuntu-latest
31
+ needs:
32
+ - release-build
33
+ permissions:
34
+ id-token: write
35
+ steps:
36
+ - name: Retrieve release distributions
37
+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
38
+ with:
39
+ name: release-dists
40
+ path: dist/
41
+ - name: Publish release distributions to PyPI
42
+ uses: pypa/gh-action-pypi-publish@release/v1
43
+ with:
44
+ packages-dir: dist/
@@ -0,0 +1,81 @@
1
+ name: Quality
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ python-version:
19
+ - "3.10"
20
+ - "3.11"
21
+ - "3.12"
22
+ - "3.13"
23
+ - "3.14"
24
+
25
+ steps:
26
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
27
+ - name: Install uv and set the python version
28
+ uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ enable-cache: true
32
+ - name: Install the project
33
+ run: make build
34
+
35
+ lint:
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ strategy:
39
+ matrix:
40
+ python-version:
41
+ - "3.10"
42
+ - "3.11"
43
+ - "3.12"
44
+ - "3.13"
45
+ - "3.14"
46
+
47
+ steps:
48
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
49
+ - name: Install uv and set the python version
50
+ uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7
51
+ with:
52
+ python-version: ${{ matrix.python-version }}
53
+ enable-cache: true
54
+ - name: Lint with Black
55
+ run: make lint-black-check
56
+ - name: Lint with Ruff
57
+ run: make lint-ruff
58
+
59
+ test:
60
+ needs: build
61
+ runs-on: ubuntu-latest
62
+ strategy:
63
+ matrix:
64
+ python-version:
65
+ - "3.10"
66
+ - "3.11"
67
+ - "3.12"
68
+ - "3.13"
69
+ - "3.14"
70
+
71
+ steps:
72
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
73
+ - name: Install uv and set the python version
74
+ uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7
75
+ with:
76
+ python-version: ${{ matrix.python-version }}
77
+ enable-cache: true
78
+ - name: Initialize the project for testing
79
+ run: make bootstrap
80
+ - name: Test with pytest
81
+ run: make test
@@ -0,0 +1,21 @@
1
+ # Python
2
+ *.py[cod]
3
+ *.egg-info
4
+ .cache
5
+ .coverage*
6
+ .DS_Store
7
+ .eggs
8
+ .ruff_cache
9
+ .pytest_cache
10
+ .tox
11
+ __pycache__/
12
+
13
+ # Project
14
+ build/
15
+ dist/
16
+ env/
17
+ tests/resources/output.pdf
18
+ venv/
19
+
20
+ # Tests
21
+ *.pdf
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to
7
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [2.0.0] - 2026-01-09
12
+
13
+ ### Added
14
+
15
+ - Add an Alpine Linux lightweight Docker image
16
+ - Consider every input markdown source as a Jinja template
17
+
18
+ ### Changed
19
+
20
+ - Switch to `uv` for packaging and dependency management
21
+ - Add extra extensions to the default extensions list
22
+
23
+ ### Removed
24
+
25
+ - Drop support for python < 3.10
26
+
27
+ ## [1.0.1] - 2023-04-12
28
+
29
+ ### Fixed
30
+
31
+ - Fix md2pdf module loading during installation
32
+
33
+ ## [1.0.0] - 2023-04-12
34
+
35
+ ### Fixed
36
+
37
+ - Fix installation issue
38
+
39
+ ### Removed
40
+
41
+ - Drop support for python < 3.8
42
+
43
+ ## [0.6] - 2023-04-07
44
+
45
+ ### Added
46
+
47
+ - Add markdown footnotes support
48
+
49
+ ### Fixed
50
+
51
+ - Fix package entrypoint for windows
52
+
53
+ ## [0.5] - 2021-01-21
54
+
55
+ ### Added
56
+
57
+ - Add markdown table support
58
+
59
+ ### Changed
60
+
61
+ - Improve python 3 support
62
+ - Improve Docker support
63
+
64
+ ## [0.4] - 2016-10-12
65
+
66
+ ### Added
67
+
68
+ - Add current directory as `base_url` to md2pdf script (Fix #6)
69
+
70
+ [unreleased]: https://github.com/jmaupetit/md2pdf/compare/2.0.0...main
71
+ [2.0.0]: https://github.com/jmaupetit/md2pdf/compare/1.0.1...2.0.0
72
+ [1.0.1]: https://github.com/jmaupetit/md2pdf/compare/1.0.0...1.0.1
73
+ [1.0.0]: https://github.com/jmaupetit/md2pdf/compare/0.6...1.0.0
74
+ [0.6]: https://github.com/jmaupetit/md2pdf/compare/0.5...0.6
75
+ [0.5]: https://github.com/jmaupetit/md2pdf/compare/0.4...0.5
76
+ [0.4]: https://github.com/jmaupetit/md2pdf/compare/0.3...0.4
@@ -0,0 +1,47 @@
1
+ # Install uv
2
+ FROM python:3.12-slim AS base
3
+
4
+ LABEL org.opencontainers.image.authors="Julien Maupetit <julien@maupetit.net>"
5
+
6
+ # Upgrade system packages to install security updates and weasyprint dependencies
7
+ RUN apt update && \
8
+ apt -y upgrade && \
9
+ apt install -y \
10
+ libpango-1.0-0 \
11
+ libpangoft2-1.0-0 \
12
+ libharfbuzz-subset0 \
13
+ && \
14
+ rm -rf /var/lib/apt/lists/*
15
+
16
+ # Change the working directory to the `app` directory
17
+ WORKDIR /app
18
+
19
+ #
20
+ # -- BUILDER --
21
+ #
22
+ FROM base AS builder
23
+
24
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
25
+
26
+ # Install dependencies
27
+ RUN --mount=type=cache,target=/root/.cache/uv \
28
+ --mount=type=bind,source=uv.lock,target=uv.lock \
29
+ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
30
+ uv sync --locked --no-install-project --no-editable
31
+
32
+ # Copy the project into the intermediate image
33
+ COPY . /app
34
+
35
+ # Sync the project
36
+ RUN --mount=type=cache,target=/root/.cache/uv \
37
+ uv sync --locked --no-editable
38
+
39
+ #
40
+ # -- PRODUCTION --
41
+ #
42
+ FROM base AS production
43
+
44
+ # Copy the environment, but not the source code
45
+ COPY --from=builder --chown=app:app /app/.venv /app/.venv
46
+
47
+ ENTRYPOINT ["/app/.venv/bin/md2pdf"]
@@ -0,0 +1,49 @@
1
+ # Install uv
2
+ FROM python:3.12-alpine AS base
3
+
4
+ LABEL org.opencontainers.image.authors="Julien Maupetit <julien@maupetit.net>"
5
+
6
+ # Upgrade system packages to install security updates and weasyprint dependencies
7
+ RUN apk add --no-cache \
8
+ so:libgobject-2.0.so.0 \
9
+ so:libpango-1.0.so.0 \
10
+ so:libharfbuzz.so.0 \
11
+ so:libharfbuzz-subset.so.0 \
12
+ so:libfontconfig.so.1 \
13
+ so:libpangoft2-1.0.so.0 \
14
+ font-liberation \
15
+ font-liberation-sans-narrow \
16
+ ttf-linux-libertine
17
+
18
+ # Change the working directory to the `app` directory
19
+ WORKDIR /app
20
+
21
+ #
22
+ # -- BUILDER --
23
+ #
24
+ FROM base AS builder
25
+
26
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
27
+
28
+ # Install dependencies
29
+ RUN --mount=type=cache,target=/root/.cache/uv \
30
+ --mount=type=bind,source=uv.lock,target=uv.lock \
31
+ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
32
+ uv sync --locked --no-install-project --no-editable
33
+
34
+ # Copy the project into the intermediate image
35
+ COPY . /app
36
+
37
+ # Sync the project
38
+ RUN --mount=type=cache,target=/root/.cache/uv \
39
+ uv sync --locked --no-editable
40
+
41
+ #
42
+ # -- PRODUCTION --
43
+ #
44
+ FROM base AS production
45
+
46
+ # Copy the environment, but not the source code
47
+ COPY --from=builder --chown=app:app /app/.venv /app/.venv
48
+
49
+ ENTRYPOINT ["/app/.venv/bin/md2pdf"]
md2pdf-2.0.0/Makefile ADDED
@@ -0,0 +1,69 @@
1
+ # -- General
2
+ SHELL := /bin/bash
3
+
4
+ UV = uv
5
+ UV_RUN = $(UV) run
6
+
7
+ # ==============================================================================
8
+ # RULES
9
+
10
+ default: help
11
+
12
+ bootstrap: ## boostrap the project to start hacking
13
+ bootstrap: \
14
+ build
15
+ .PHONY: bootstrap
16
+
17
+ build: ## install project with its dependencies
18
+ $(UV) sync --locked --all-extras --dev
19
+ .PHONY: build
20
+
21
+
22
+ build-docker: ## build Docker images
23
+ build-docker: \
24
+ build-docker-debian \
25
+ build-docker-alpine
26
+ .PHONY: build-docker
27
+
28
+ build-docker-debian: ## build Docker (debian) image
29
+ docker build . --target production --tag jmaupetit/md2pdf:latest
30
+ .PHONY: build-docker-debian
31
+
32
+ build-docker-alpine: ## build Docker (alpine) image
33
+ docker build . -f Dockerfile.alpine --target production --tag jmaupetit/md2pdf:alpine
34
+ .PHONY: build-docker-alpine
35
+
36
+ lint: ## lint all sources
37
+ lint: \
38
+ lint-black \
39
+ lint-ruff
40
+ .PHONY: lint
41
+
42
+ lint-black: ## lint python sources with black
43
+ @echo 'lint:black started…'
44
+ uv run black src/md2pdf tests
45
+ .PHONY: lint-black
46
+
47
+ lint-black-check: ## check python sources with black
48
+ @echo 'lint:black check started…'
49
+ uv run black --check src/md2pdf tests
50
+ .PHONY: lint-black-check
51
+
52
+ lint-ruff: ## lint python sources with ruff
53
+ @echo 'lint:ruff started…'
54
+ uv run ruff check src/md2pdf tests
55
+ .PHONY: lint-ruff
56
+
57
+ lint-ruff-fix: ## lint and fix python sources with ruff
58
+ @echo 'lint:ruff-fix started…'
59
+ uv run ruff check --fix src/md2pdf tests
60
+ .PHONY: lint-ruff-fix
61
+
62
+ test: ## run the test suite
63
+ $(UV_RUN) pytest
64
+ .PHONY: test
65
+
66
+ # -- Misc
67
+ help:
68
+ @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
69
+ .PHONY: help