tc39 / tc39/ecmarkup

regex highlighting

Open
#135 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
245
Forks
80
Avg merge
10h 46m
Merged PRs (30d)
2

Description

The lines:

/a[a-z]{2,4}?/.exec("abcdefghi")
/(aa|aabaac|ba|b|c)*/.exec("aabaac")
/(z)((a+)?(b+)?(c))*/.exec("zaacbbbcac")
/(a*)*/.exec("b")
/(a*)b\1+/.exec("baaaac")

are highlighted oddly, because the <span class="hljs-regexp">...</span> markup is surrounding the wrong text.

In contrast, the line:
"aaaaaaaaaa,aaaaaaaaaaaaaaa".replace(/^(a+)\1*,\1+$/,"$1")
has the regex correctly highlighted.

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

Start with the five regex examples in the issue and compare their generated span boundaries with the correctly highlighted replace example. Trace the regex-highlighting path that produces the markup, then verify that each example wraps only its regex text and not surrounding content.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.