Generisches Skript zur Konvertierung aller Mermaid-Diagramme
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
$scriptDir = $PSScriptRoot
|
||||
$cfgFile = Join-Path $scriptDir 'mermaid-config.json'
|
||||
|
||||
$imgName = "ext-kunde__stufen"
|
||||
$srcFile = Join-Path $scriptDir "$imgName.mmd"
|
||||
$destFile1 = Join-Path $scriptDir "$imgName.svg"
|
||||
$destFile2 = Join-Path $scriptDir "$imgName.png"
|
||||
mmdc -i $srcFile -o $destFile1 -c $cfgFile
|
||||
mmdc -i $srcFile -o $destFile2 -s 3
|
||||
|
||||
$imgName = "ext-kunde__architektur"
|
||||
$srcFile = Join-Path $scriptDir "$imgName.mmd"
|
||||
$destFile1 = Join-Path $scriptDir "$imgName.svg"
|
||||
$destFile2 = Join-Path $scriptDir "$imgName.png"
|
||||
mmdc -i $srcFile -o $destFile1 -c $cfgFile
|
||||
mmdc -i $srcFile -o $destFile2 -s 3
|
||||
@@ -0,0 +1,43 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $false, Position = 0)]
|
||||
[string]$RelativePath = ".",
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]$Recurse
|
||||
)
|
||||
|
||||
$scriptDir = $PSScriptRoot
|
||||
$cfgFile = Join-Path $scriptDir 'mermaid-config.json'
|
||||
|
||||
$targetDir = Join-Path $scriptDir $RelativePath
|
||||
|
||||
if (-not (Test-Path $targetDir)) {
|
||||
Write-Error "Der Zielordner '$targetDir' existiert nicht."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$mmdFiles = Get-ChildItem -Path $targetDir -Filter '*.mmd' -Recurse:$Recurse
|
||||
|
||||
if ($mmdFiles.Count -eq 0) {
|
||||
Write-Host "Keine .mmd-Dateien in '$targetDir' gefunden." -ForegroundColor Yellow
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "Verarbeite Ordner: $targetDir (Rekursiv: $Recurse)" -ForegroundColor Yellow
|
||||
|
||||
foreach ($file in $mmdFiles) {
|
||||
Write-Host "Konvertiere $($file.Name) ($($file.DirectoryName))..." -ForegroundColor Cyan
|
||||
|
||||
$destSvg = Join-Path $file.DirectoryName "$($file.BaseName).svg"
|
||||
$destPng = Join-Path $file.DirectoryName "$($file.BaseName).png"
|
||||
|
||||
if (Test-Path $cfgFile) {
|
||||
mmdc -i $file.FullName -o $destSvg -c $cfgFile
|
||||
} else {
|
||||
mmdc -i $file.FullName -o $destSvg
|
||||
}
|
||||
|
||||
mmdc -i $file.FullName -o $destPng -s 3
|
||||
}
|
||||
|
||||
Write-Host "Fertig! Alle Diagramme wurden konvertiert." -ForegroundColor Green
|
||||
Reference in New Issue
Block a user