PrismJS / PrismJS/prism

Inserting raw text for .token.parameter causes difficulties theming Typescript

Open
#2,087 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Motivation
In Typescript I want to theme parameter names and their types separately, but sometimes this is not possible at all due to raw text that cannot be tracked by CSS rules.

Description
When a type for a parameter is not a builtin or styled otherwise, this happens when styling .token.parameter:

image

The generated HTML just inserts the parameter and the type as plain text:

image

As you can see, the strings are written raw to the output without wrapping them at all. I can't even use :first-child to track the parameter name.

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 reproducing the TypeScript example and inspecting how .token.parameter produces the generated HTML. Trace the parameter token handling, then verify that parameter names and non-builtin types are independently targetable rather than inserted as unwrapped raw text.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.