Skip to content

Replace regex-based markdown parsing with AST-based parsing #38

Description

@jakehildreth

Problem

Deck's inline/block parsing is a pipeline of regexes over flat strings:

  • ConvertTo-SpectreMarkup applies bullet/bold/italic/color passes by regex with no structural context
  • ConvertFrom-DeckMarkdown splits slides by --- matching with code-fence placeholders
  • ConvertTo-CodeBlockSegments splits code blocks by non-greedy fence regex
  • New-TableRenderable splits tables by | string ops

The converter receives bare strings with no context. It cannot distinguish a list item - 5% from a table cell containing - 5%, a fence-closing `````` from one inside a code sample, or a heading from heading-like text in code.

Concrete bugs caused by this architecture

Proposed direction

Adopt a real markdown parser producing an AST, then render by walking typed nodes:

Candidate engines: Markdig (.NET, CommonMark + GFM, loadable from PowerShell), or a PowerShell-native wrapper. Evaluate Markdig first — mature, MIT, single DLL, and Spectre.Console already proves the .NET-dependency pattern works for this module.

Non-goals for this issue

Relation to other issues

Supersedes the root cause of #4, #5, #9, #25. Those remain fixable independently in the interim.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions