commonmark / commonmark/cmark

incorrect start_column & end_column

Open
#442 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2k
Forks
691
Avg merge
1d 16h
Merged PRs (30d)
1

Description

The text: - \na

Creates the following hierarchy:

  • Document
    • List
      • Paragraph
        • Text

This AST has the following {start_line, end_line, start_column, end_column}

  • Document: {1, 2, 1, 1}
    • List: {1, 2, 1, 1}
      • Paragraph: {1, 2, 3, 1}
        • Text: {2, 2, 3, 3}

{2, 2, 3, 3} (the Text bounds) exceed the bounds for the document, and violates some assumptions which cause my application to panic.

I couldn't find any documentation which makes it clear whether this is a bug or not, but my intuition says that this is a bug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the input - \na and inspect the generated Document, List, Paragraph, and Text AST bounds. Trace where start_column and end_column are calculated, then add or update a regression test showing the expected bounds and confirming the parser no longer produces inconsistent hierarchy ranges.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.