PrismJS / PrismJS/prism

Specify highlighting language for data-output

Open
#1,695 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

At the moment the command-line plugin will have no prompt nor syntax highlighting for lines denoted using data-output. The command lines will be coloured using the language- class.

It would be fantastic to have another attribute to specify a syntax highlighting language for the data-output lines. Perhaps extend data-output to allow language to be specified here too?: e.g.:

<pre class="command-line language-bash" data-output="2-99 language-json" data-prompt="$"><code>
az account show --output jsonc
{
  "environmentName": "AzureCloud",
  "id": "2d31be49-d999-4415-bb65-8aec2c90ba62",
  "isDefault": true,
  "name": "Visual Studio Enterprise",
  "state": "Enabled",
  "tenantId": "76f988bf-86f1-41af-91ab-2d7cd011db47",
  "user": {
    "cloudShellID": true,
    "name": "richeney@microsoft.com",
    "type": "user"
  }
}
</code></pre>

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 locating the command-line plugin and reading how data-output ranges are parsed and highlighted. Check any existing plugin tests or examples, then support a language value on data-output while preserving the language used for command lines; done means the shown JSON output is highlighted separately from the bash command.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
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.