Consider allowing Nodes with a "fragment" type.
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2k
- Forks
- 691
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 1
Description
I'm interested in manipulating markdown ASTs.
It's sometimes problematic to extract a fragment, e.g.
header = Markly.parse("### Hello `World`").first_child
fragment = header.extract_children # Move all children to a node of type `custom`
fragment.to_markdown # => "Hello `World`\n\n"
I'm having trouble with the output formatting.
Ideally, the fragment would just be the raw children, e.g.
fragment.to_markdown # => "Hello `World`"
This would make it a little easier to mash up the AST with different types of outputs.
I suppose the issue is the formatting of custom type nodes, but I'm not sure if there is a problem to change this.
In other words, either (1) we could change the output to be "inline" or add an inline "fragment" node type which does minimal formatting. Thoughts?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Markly.parse, extract_children, and to_markdown behavior shown in the issue, then inspect how custom nodes are rendered in cmark. Decide whether raw child output or a fragment node is the intended API, and verify that the resulting fragment renders as "Hello World" without the extra wrapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, markdown
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100