commonmark / commonmark/cmark

Issue with rendering whitespace to commonmark

Open
#566 1 comment 0 reactions 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

There is an issue with cmark_render_commonmark function when it gets as an input a document that has a text node with a whitespace in the beginning, it does not return a correct markdown string.

For example, the following document:
Document node -> Paragraph node -> Text node with text literal
is rendered as text\n, which is a code block.

From looking at some other implementation I see the whitespace is replaced with  . Can this applied in cmark? thanks

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

Start at the cmark_render_commonmark function and reproduce the issue with a paragraph containing a text node beginning with four spaces. Trace how leading whitespace is rendered, then verify that the resulting CommonMark no longer becomes a code block and preserves the intended text representation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.