PrismJS / PrismJS/prism

Environment-independent method to get the text content of HTML

Open
#2,979 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Motivation
In #2977, I added a pretty hacky way to get the text content of an HTML string. This was necessary because the method has to work in both browsers and NodeJS and should behave consistently across environments.

Description
Add a method to get the text content of an HTML string. It has to be:

  1. Safe: No script execution or left-over tags
  2. Correct: No left-over tags or entities
  3. Consistent: Same result in all browsers/environments.

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

Start by reviewing the implementation added in issue #2977 and the existing HTML text-content method. Compare its behavior in browsers and NodeJS, focusing on script safety, tag and entity removal, and identical results across environments. Done means the method satisfies all three requirements consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.