PrismJS / PrismJS/prism

[v2] Handle strings in grammars as whole word literals

Open
#3,913 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13k
Forks
1.4k
Avg merge
15h 36m
Merged PRs (30d)
3

Description

I.e. transform ['foo', 'bar'] to the regex /\bfoo\b|\bbar\b/. This will simplify a lot of language definitions.

Caveat: we may need \B instead of \bdepending on what the string starts and ends with.

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

The issue does not name files, tests, or entry points. Start by locating the grammar-processing code that handles arrays of strings, then verify how whole-word boundaries should be selected for different string starts and ends. Done means arrays such as ['foo', 'bar'] produce equivalent whole-word literal matching without breaking other grammar definitions.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.