{"id":10141,"date":"2026-05-27T10:58:41","date_gmt":"2026-05-27T09:58:41","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=10141"},"modified":"2026-05-27T13:01:12","modified_gmt":"2026-05-27T12:01:12","slug":"pandoc-convert-markdown-to-html","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/pandoc-convert-markdown-to-html\/","title":{"rendered":"Pandoc &#8211; convert Markdown to HTML"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">And much more&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/jgm\/pandoc\/releases\/latest\">https:\/\/github.com\/jgm\/pandoc\/releases\/latest<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pandoc.org\/MANUAL.html\">https:\/\/pandoc.org\/MANUAL.html<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For fast single-page conversion use the inline-browser tool StackEdit:<br><a href=\"https:\/\/stackedit.io\/app#\">https:\/\/stackedit.io\/app#<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"sh\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">pandoc -f markdown -t html -o .\\output.html -M mainfont:sans-serif -M maxwidth:72em --standalone .\\input.md<\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">And with a powershell script for converting an entire folder:<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"powershell\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">param(\n    [Parameter(Position = 0)]\n    [string]$Path,\n\n    [switch]$Recurse\n)\n\n$ErrorActionPreference = 'Stop'\n\n# Fallback to current directory when no path is provided.\nif ([string]::IsNullOrWhiteSpace($Path)) {\n    $TargetPath = (Get-Location).Path\n}\nelse {\n    $TargetPath = (Resolve-Path -Path $Path).Path\n}\n\nif (-not (Test-Path -Path $TargetPath -PathType Container)) {\n    throw \"Target path is not a directory: $TargetPath\"\n}\n\n$pandocCommand = Get-Command pandoc -ErrorAction SilentlyContinue\nif ($null -eq $pandocCommand) {\n    throw \"pandoc is not available in PATH. Install pandoc first and try again.\"\n}\n\n$searchParams = @{\n    Path   = $TargetPath\n    Filter = '*.md'\n    File   = $true\n}\n\nif ($Recurse) {\n    $searchParams.Recurse = $true\n}\n\n$markdownFiles = Get-ChildItem @searchParams | Sort-Object FullName\n\nif ($markdownFiles.Count -eq 0) {\n    Write-Host \"No markdown files found in: $TargetPath\"\n    exit 0\n}\n\nWrite-Host \"Found $($markdownFiles.Count) markdown file(s) in: $TargetPath\"\n\nforeach ($mdFile in $markdownFiles) {\n    $htmlPath = [System.IO.Path]::ChangeExtension($mdFile.FullName, '.html')\n\n    Write-Host \"Converting: $($mdFile.FullName)\"\n\n    $pandocArgs = @(\n        '-f', 'markdown',\n        '-t', 'html',\n        '-o', $htmlPath,\n        '-M', 'mainfont:sans-serif',\n        '-M', 'maxwidth:72em',\n        '--standalone',\n        $mdFile.FullName\n    )\n\n    &amp; pandoc @pandocArgs\n\n    if ($LASTEXITCODE -ne 0) {\n        throw \"pandoc failed for file: $($mdFile.FullName)\"\n    }\n}\n\nWrite-Host \"Done. Converted $($markdownFiles.Count) markdown file(s) to HTML.\"\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>And much more&#8230; https:\/\/github.com\/jgm\/pandoc\/releases\/latest https:\/\/pandoc.org\/MANUAL.html For fast single-page conversion use the inline-browser tool StackEdit:https:\/\/stackedit.io\/app# Example: And with a powershell script for converting an entire folder:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10141","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/10141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=10141"}],"version-history":[{"count":4,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/10141\/revisions"}],"predecessor-version":[{"id":10148,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/10141\/revisions\/10148"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=10141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=10141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=10141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}