PrismJS / PrismJS/prism

reStructuredText roles with two parts are not highlighted

Open
#3,611 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

Information:

  • Prism version: latest
  • Plugins: n/a
  • Environment: browser

Description
While translating in Weblate, which uses PrimJS for reStructeredText syntax highlighting, I noticed that roles with two-parts are note being highlighted. E.g. :py:mod:, :http:get:. Common roles works perfectly e.g. :ref:.

This issue was originally reported in https://github.com/WeblateOrg/weblate/issues/8480 but I was directed to this project.

The rule for highlighting is in components/prism-rest.js, line 158, but I haven't figured out a solution to propose :)

Example

See ":http:get:" in the screenshot below:

Captura de tela de 2022-12-14 08-09-09

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

Inspect the role-highlighting rule in components/prism-rest.js around line 158. Reproduce the behavior with :py:mod: and :http:get:, comparing it with the working :ref: example. Done means two-part reStructuredText roles are highlighted correctly without regressing common roles.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.