mkdocs-md-to-pdf 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
mkdocs_md_to_pdf/cli.py CHANGED
@@ -14,7 +14,8 @@ def main() -> None:
14
14
  )
15
15
  parser.add_argument("input_file", help="Path to the markdown file to convert")
16
16
  parser.add_argument(
17
- "-o", "--output",
17
+ "-o",
18
+ "--output",
18
19
  help="Output PDF file path (default: write to stdout)",
19
20
  )
20
21
  args = parser.parse_args()
@@ -5,6 +5,7 @@ import os
5
5
  import re
6
6
  import shutil
7
7
  import subprocess
8
+ import sys
8
9
  import tempfile
9
10
  import time
10
11
  from pathlib import Path
@@ -14,9 +15,11 @@ from playwright.sync_api import sync_playwright
14
15
 
15
16
  def _get_template_content() -> str:
16
17
  """Load the mkdocs.yml template from package resources."""
17
- return importlib.resources.files("mkdocs_md_to_pdf").joinpath(
18
- "mkdocs.yml.template"
19
- ).read_text()
18
+ return (
19
+ importlib.resources.files("mkdocs_md_to_pdf")
20
+ .joinpath("mkdocs.yml.template")
21
+ .read_text()
22
+ )
20
23
 
21
24
 
22
25
  def _create_temp_mkdocs_config(input_file: Path, temp_dir: Path) -> Path:
@@ -36,9 +39,9 @@ def _create_temp_mkdocs_config(input_file: Path, temp_dir: Path) -> Path:
36
39
  if linked_file_path.is_file():
37
40
  shutil.copy2(linked_file_path, temp_docs_dir)
38
41
 
39
- config_content = template_content.replace(
40
- "{{site_name}}", input_file.name
41
- ).replace("{{docs_dir}}", "docs")
42
+ config_content = template_content.replace("{{site_name}}", input_file.name).replace(
43
+ "{{docs_dir}}", "docs"
44
+ )
42
45
 
43
46
  temp_config_path = temp_dir / "mkdocs.yml"
44
47
  temp_config_path.write_text(config_content)
@@ -67,10 +70,13 @@ def _extract_linked_files(input_file: Path) -> list[str]:
67
70
 
68
71
  def _serve_mkdocs(temp_dir: Path, port: int = 8765) -> subprocess.Popen:
69
72
  """Build and serve the mkdocs site."""
70
- subprocess.run(["mkdocs", "build"], cwd=temp_dir, check=True, capture_output=True)
73
+ mkdocs_cmd = [sys.executable, "-m", "mkdocs"]
74
+ subprocess.run(
75
+ [*mkdocs_cmd, "build"], cwd=temp_dir, check=True, capture_output=True
76
+ )
71
77
 
72
78
  server_process = subprocess.Popen(
73
- ["mkdocs", "serve", "-a", f"127.0.0.1:{port}"],
79
+ [*mkdocs_cmd, "serve", "-a", f"127.0.0.1:{port}"],
74
80
  cwd=temp_dir,
75
81
  stdout=subprocess.PIPE,
76
82
  stderr=subprocess.PIPE,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-md-to-pdf
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Convert Markdown files to PDF using MkDocs Material theme and Playwright
5
5
  Keywords: markdown,pdf,mkdocs,converter,documentation
6
6
  Author: Lode Rosseel
@@ -25,8 +25,8 @@ Requires-Dist: pytest>=8.0 ; extra == 'dev'
25
25
  Requires-Dist: pytest-mock>=3.14 ; extra == 'dev'
26
26
  Requires-Python: >=3.12
27
27
  Project-URL: Homepage, https://github.com/lode-braced/mkdocs-md-to-pdf
28
- Project-URL: Issues, https://github.com/lode-braced/mkdocs-md-to-pdf/issues
29
28
  Project-URL: Repository, https://github.com/lode-braced/mkdocs-md-to-pdf
29
+ Project-URL: Issues, https://github.com/lode-braced/mkdocs-md-to-pdf/issues
30
30
  Provides-Extra: dev
31
31
  Description-Content-Type: text/markdown
32
32
 
@@ -0,0 +1,8 @@
1
+ mkdocs_md_to_pdf/__init__.py,sha256=Ih5ErAUbTtB4YCMlNqEdgfOalEKr6lyHtotWNygcpNI,189
2
+ mkdocs_md_to_pdf/cli.py,sha256=UREBlKs9j1hAnf66PrqZsyAAWXKDWhaTYPUQRMAhsKI,987
3
+ mkdocs_md_to_pdf/converter.py,sha256=2v11mqzE6q9E3nXCSHjMh7eZRQfuoMOxlYUOy61i8I0,4173
4
+ mkdocs_md_to_pdf/mkdocs.yml.template,sha256=3EGjB234Y6SpRzrE6WaojKuCLHbGiYRqfWVaEW6Q4gg,1037
5
+ mkdocs_md_to_pdf-0.1.2.dist-info/WHEEL,sha256=iHtWm8nRfs0VRdCYVXocAWFW8ppjHL-uTJkAdZJKOBM,80
6
+ mkdocs_md_to_pdf-0.1.2.dist-info/entry_points.txt,sha256=lXP623vPGGqwOzoXnTti5IzLJvYped-u6hQEramERto,57
7
+ mkdocs_md_to_pdf-0.1.2.dist-info/METADATA,sha256=uP_rwwxaoHuO3JCBmpT0x3NoiIHbiBqoPb1mpP8DCzk,3092
8
+ mkdocs_md_to_pdf-0.1.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.25
2
+ Generator: uv 0.9.30
3
3
  Root-Is-Purelib: true
4
- Tag: py3-none-any
4
+ Tag: py3-none-any
@@ -1,8 +0,0 @@
1
- mkdocs_md_to_pdf/__init__.py,sha256=Ih5ErAUbTtB4YCMlNqEdgfOalEKr6lyHtotWNygcpNI,189
2
- mkdocs_md_to_pdf/cli.py,sha256=y7LbfLF0bAOxNG4EIfkDAbVhJbRml1rD3yzfJlSj-qA,979
3
- mkdocs_md_to_pdf/converter.py,sha256=4OA1pUSkdtYcAZ4Pv_vEp65H5jlhdett_zZOZFnMjdg,4072
4
- mkdocs_md_to_pdf/mkdocs.yml.template,sha256=3EGjB234Y6SpRzrE6WaojKuCLHbGiYRqfWVaEW6Q4gg,1037
5
- mkdocs_md_to_pdf-0.1.1.dist-info/WHEEL,sha256=XjEbIc5-wIORjWaafhI6vBtlxDBp7S9KiujWF1EM7Ak,79
6
- mkdocs_md_to_pdf-0.1.1.dist-info/entry_points.txt,sha256=lXP623vPGGqwOzoXnTti5IzLJvYped-u6hQEramERto,57
7
- mkdocs_md_to_pdf-0.1.1.dist-info/METADATA,sha256=lBSkqOC6poZxkV2RWY8F5S7L8IikaPE9ZKcnL2YX5NQ,3092
8
- mkdocs_md_to_pdf-0.1.1.dist-info/RECORD,,