commonmark / commonmark/commonmark.js

Source information missing from parsed nodes

Open
#173 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
231
Avg merge
2d 11h
Merged PRs (30d)
3

Description

I'm making a renderer that will modify a tree in-place, but can roundtrip MarkDown back to the same MarkDown (or mostly the same).

There is some information missing from the parsed nodes that would be useful reconstructing the original document. In particular:

  • Whether a code_block was originally fenced or indented.
  • What symbol was used for emphasis, either * or _.

Can these be added to the parse nodes?

Contributor guide

Open the contributing guide

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

Begin by locating the parser code that creates parsed nodes and the handling for code_block and emphasis. Check how node attributes are represented and how existing parser tests cover these constructs. Done means nodes preserve fenced-versus-indented origin and the * versus _ emphasis marker, with tests demonstrating both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.