옵시디언 MD 파일은 첫 번째 제목이 파일명에만 있고 첨부 이미지도 특수한 문법을 쓰므로 고칠 필요가 있다. 또한 편집상 편의를 위해 링크도 노출되게 바꾼다.
✓ Published0🌍 Public
Aanemochore
Last edited Sep 19, 2024
Created on Jul 23, 2024
This example demonstrates a preprocessing pipeline that transforms Obsidian markdown files into a format suitable for Pandoc conversion to HTML and eventually Word. The script walks a directory tree, merging all `.md` files into a single `merged.md`, while modifying image syntax from `![[...]]` to standard markdown, exposing link URLs, and adding the filename as a top-level heading. It also inserts a non-breaking space between consecutive code blocks to prevent merging. The code relies on Python’s `os.walk` and `re.sub` for file traversal and regex-based text manipulation, with Pandoc invoked externally for the final conversion.
AI-generated description