@@ -0,0 +1,35 @@
|
||||
# Build PDF from markdown via two pipelines:
|
||||
# 1) MD → LaTeX project (Python md2latex)
|
||||
# 2) LaTeX → PDF (XeLaTeX / latexmk)
|
||||
#
|
||||
# Usage:
|
||||
# powershell -File scripts\md2pdf.ps1 examples\example.md
|
||||
# powershell -File scripts\md2pdf.ps1 report.md -OutDir build\report -TitlePage title.pdf
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true, Position = 0)]
|
||||
[string]$Markdown,
|
||||
|
||||
[string]$OutDir = "",
|
||||
|
||||
[string]$TitlePage = "",
|
||||
|
||||
[switch]$NoPdf
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
Set-Location $Root
|
||||
|
||||
$md = Resolve-Path $Markdown
|
||||
if (-not $OutDir) {
|
||||
$OutDir = Join-Path (Split-Path $md) (([IO.Path]::GetFileNameWithoutExtension($md)) + "_latex")
|
||||
}
|
||||
|
||||
$pyArgs = @("-m", "md2latex", "$md", "-o", "$OutDir")
|
||||
if ($TitlePage) { $pyArgs += @("--titlepage", "$TitlePage") }
|
||||
if (-not $NoPdf) { $pyArgs += "--pdf" }
|
||||
|
||||
Write-Host "=== Pipeline 1+2: MD → LaTeX → PDF ==="
|
||||
& python @pyArgs
|
||||
exit $LASTEXITCODE
|
||||
Reference in New Issue
Block a user