Stabilize core correctness and sync project plan state
This commit is contained in:
@@ -17,10 +17,10 @@ class ParsedDocument:
|
||||
headings: list[tuple[int, str]] = field(default_factory=list)
|
||||
|
||||
|
||||
def parse_markdown(file_path: Path) -> ParsedDocument:
|
||||
def parse_markdown(file_path: Path, text: str | None = None) -> ParsedDocument:
|
||||
"""Parse a markdown file, extracting frontmatter and structure."""
|
||||
text = file_path.read_text(encoding="utf-8")
|
||||
post = frontmatter.loads(text)
|
||||
raw_text = text if text is not None else file_path.read_text(encoding="utf-8")
|
||||
post = frontmatter.loads(raw_text)
|
||||
|
||||
meta = dict(post.metadata) if post.metadata else {}
|
||||
body = post.content.strip()
|
||||
|
||||
Reference in New Issue
Block a user