commonmark / commonmark/commonmark.js
Add "exclude" (and/or "include") option to parser options
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 231
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 3
Description
I'm working on a chat application, and want to offer a (quite conservative) subset of markdown, but it turns out to be next to impossible to find any way to do so without writing something from scratch.
It would be really great if it were possible to pass in a set of desired formats (and/or a set to exclude), and have the parser only parse the resulting set of formats.
For example, we would like to only support code_fences, code_spans, bold, and italic. (think slack, but commonmark-compliant).
From checking the implementation, it seems to me that checking the options at construction and removing the functions for undesired formats from the parser instance would be a simple enough way to provide this functionality.
I'd be willing to PR this myself if the feature is accepted.
Contributor guide
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 by tracing parser construction and how parser options are handled. Define how include and exclude sets interact, then verify that only the requested formats—such as code fences, code spans, bold, and italic—are parsed while other formats remain unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100