kt-event-marketing/tools/extract-mermaid-charts.ps1
merrycoral c1f116c821 Mermaid 차트 14개를 개별 .mmd 파일로 추출 완료
- 14개 시장조사 차트를 개별 .mmd 파일로 분리
- 차트 변환 가이드 2종 추가 (README.md, 차트변환가이드.md)
- Mermaid Live Editor 활용 방법 상세 안내
- 프레젠테이션 시나리오별 차트 조합 추천
- 차트 문법 오류 수정 (차트 4번 막대 색상 파란색으로 변경)
- 추출 도구 스크립트 추가 (Python, PowerShell, Bash)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 14:47:01 +09:00

48 lines
1.5 KiB
PowerShell

# Mermaid Chart Extractor
# Extracts Mermaid charts from markdown and saves them as individual .mmd files
$markdownFile = "define/시장조사-차트.md"
$outputDir = "define/charts"
Write-Host "Extracting Mermaid charts from: $markdownFile"
Write-Host "Output directory: $outputDir`n"
# Create output directory
if (-not (Test-Path $outputDir)) {
New-Item -ItemType Directory -Path $outputDir | Out-Null
}
# Read markdown file
$content = Get-Content $markdownFile -Raw -Encoding UTF8
# Extract all mermaid blocks with their section headers
$pattern = '## (\d+)\. (.+?)\n\n```mermaid\n(.*?)```'
$matches = [regex]::Matches($content, $pattern, [System.Text.RegularExpressions.RegexOptions]::Singleline)
Write-Host "Found $($matches.Count) Mermaid charts`n"
# Save each chart
$count = 0
foreach ($match in $matches) {
$num = $match.Groups[1].Value
$title = $match.Groups[2].Value
$chartCode = $match.Groups[3].Value
# Clean filename
$filename = "chart$($num.PadLeft(2,'0'))_$($title.Replace(' ', '_').Replace('/', '_')).mmd"
$filepath = Join-Path $outputDir $filename
# Write mermaid code
$chartCode.Trim() | Out-File -FilePath $filepath -Encoding UTF8 -NoNewline
Write-Host " ✓ Saved: $filename"
$count++
}
Write-Host "`n✅ Successfully extracted $count charts!"
Write-Host "`nChart files saved in: $outputDir"
Write-Host "`nNext steps:"
Write-Host "1. Use Mermaid Live Editor: https://mermaid.live/"
Write-Host "2. Copy-paste each .mmd file content"
Write-Host "3. Export as PNG or SVG"