Skip to content

Markdown import parser upgrade #29

@TomMaSS

Description

@TomMaSS

Summary

Replace the heuristic markdown import parser with markdown-it-py AST parser for more reliable section splitting.

Motivation

Current parser uses regex-based heading detection which can misparse edge cases (headings in code blocks, non-standard markdown).

Technical Approach

  • Replace heuristic parser in prd_import_markdown with markdown-it-py
  • Parse to AST, walk tree to find heading nodes
  • Split content at h2 boundaries (configurable heading level)
  • Preserve code blocks, lists, and other markdown structures correctly

Key Files

  • mcp_server/tools/import_tools.py — prd_import_markdown implementation
  • requirements.txt — add markdown-it-py

Acceptance Criteria

  • Parser uses markdown-it-py AST
  • Headings in code blocks not treated as section boundaries
  • Existing import behavior preserved for well-formed markdown
  • Unit tests for edge cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpMCP server, 32 tools, FastMCPtype:improvementImprove existing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions