Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debugging output for renderer #123

Merged
merged 1 commit into from
Sep 12, 2024
Merged

Conversation

corhere
Copy link
Contributor

@corhere corhere commented Aug 7, 2024

Documentation on the shape of the markdown AST produced by the blackfriday parser is rather sparse. Add a decorator for renderers which dumps the visited AST nodes to stderr, interleaved with the renderer output, to help with debugging the roff renderer.

Example

Input

Definition title
: Definition description one
: And two
: And three

MD2MAN_DEBUG=1 stderr output

+ Document: '' 
  + List: '' ListTypeDefinition|ListItemBeginningOfList
    + Item: '' ListTypeDefinition|ListTypeTerm|ListItemBeginningOfList
>> "\n.TP\n"
      + Paragraph: '' 
        + Text: 'Definition title' 
>> "Definition title"
      - Paragraph: '' 
    - Item: '' ListTypeDefinition|ListTypeTerm|ListItemBeginningOfList
>> "\n"
    + Item: '' ListTypeDefinition
      + Paragraph: '' 
        + Text: 'Definition descr...' 
>> "Definition description one"
      - Paragraph: '' 
    - Item: '' ListTypeDefinition
>> "\n"
    + Item: '' ListTypeDefinition
>> "\n"
      + Paragraph: '' 
        + Text: 'And two' 
>> "And two"
      - Paragraph: '' 
    - Item: '' ListTypeDefinition
>> "\n"
    + Item: '' ListTypeDefinition
>> "\n"
      + Paragraph: '' 
        + Text: 'And three' 
>> "And three"
      - Paragraph: '' 
    - Item: '' ListTypeDefinition
>> "\n"
  - List: '' ListTypeDefinition|ListItemBeginningOfList
- Document: '' 

Documentation on the shape of the markdown AST produced by the
blackfriday parser is rather sparse. Add a decorator for renderers which
dumps the visited AST nodes to stderr, interleaved with the renderer
output, to help with debugging the roff renderer.

Signed-off-by: Cory Snider <[email protected]>
@cpuguy83 cpuguy83 merged commit 5e88164 into cpuguy83:master Sep 12, 2024
5 checks passed
Copy link
Collaborator

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@corhere corhere deleted the ast-debug branch September 12, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants