Skip to content

Conversation

@ploMP4
Copy link
Member

@ploMP4 ploMP4 commented Jun 5, 2025

This pull request adds image rendering along with a refactor to the markdown parsing engine.

Markdown Architecture

Parser:

  • An extensible parser architecture with multiple specialized parsers
  • Each parser uses a Trigger() method to identify the specific byte that activates its parsing logic
  • Supports parser prioritization to handle cases where multiple parsers share the same trigger byte
  • Implements graceful fallback: parsers return nil on failure, allowing the system to try the next parser in priority order
  • Creates GlamourNode instances when no specialized parser can handle the content

Renderer:

The Renderer consumes the nodes generated by the parser and generates the proper output

graph TB
    subgraph "Markdown Package Architecture"
        A[Input Markdown Text] --> B[MarkdownParser]
        
        subgraph "Parser Registry"
            C[Parser A<br/>Priority: 1]
            D[Parser B<br/>Priority: 2]
            E[Parser N<br/>Priority: N]
        end
        
        B --> F[Trigger-Based Parser Selection]
        C --> F
        D --> F
        E --> F
        
        subgraph "Node Types"
            G[Custom Node A]
            H[Custom Node B]
            I[GlamourNode<br/>Fallback]
        end
        
        F --> G
        F --> H
        F --> I
        
        subgraph "Renderer Components"
            J[Main Renderer]
            K[Default Renderer For GlamourNode]
            L[Custom Renderer For Node A]
            M[Custom Renderer For Node B]
        end
        
        G --> J
        H --> J
        I --> J
        
        J --> K
        J --> L
        J --> M
        
        N[Styled Terminal Output] 
        K --> N
        L --> N
        M --> N
    end
Loading

@ploMP4 ploMP4 added enhancement New feature or request help wanted Extra attention is needed labels Jun 5, 2025
@tharropoulos
Copy link
Member

Please add an example presentation so we have a common ground for what we are rendering

@ploMP4 ploMP4 force-pushed the image-rendering branch from 7ce09f3 to 96784ca Compare June 22, 2025 13:29
@ploMP4 ploMP4 force-pushed the image-rendering branch 2 times, most recently from c6a420a to e03261b Compare June 23, 2025 22:18
@ploMP4 ploMP4 removed the help wanted Extra attention is needed label Jul 18, 2025
@ploMP4 ploMP4 self-assigned this Jul 18, 2025
@ploMP4 ploMP4 changed the title Image rendering Markdown engine / Image rendering Jul 19, 2025
@ploMP4 ploMP4 force-pushed the image-rendering branch from 42133a1 to 2310f3c Compare July 19, 2025 00:20
@ploMP4 ploMP4 force-pushed the image-rendering branch from 76ba59d to ffa6439 Compare July 20, 2025 16:01
@ploMP4 ploMP4 marked this pull request as ready for review July 20, 2025 16:14
@ploMP4 ploMP4 requested a review from tharropoulos July 20, 2025 16:14
Copy link
Member

@tharropoulos tharropoulos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny little changes 😅

:shipit:

@ploMP4 ploMP4 merged commit 2c3e53b into main Jul 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants