PrismJS / PrismJS/prism

API for supported languages/plugins/etc.

Open
#2,146 0 comments 2 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
Libraries sometimes need to know all languages/plugins/etc. Prism supports.

Description
A simple API to:

  1. Check whether a given language/plugin/etc is supported.
  2. Query all languages/plugins/etc.

My suggestion is to make this a part of components.js. Something like:

components.supported(lang: string | string[]): boolean;
components.supported.languages: string[];
components.supported.plugins: string[];

The other properties of the components object are still private to Prism. By implementing the API in components.js, both browser and NodeJS devs have easy access to it.

Alternatives
Document components.json and declare it to be a part of Prism's public API. Right now, it's considered a private part of Prism, so we could make it public.
This has the obvious downside that changes to components.json might be breaking and it takes a lot of freedom from Prism's core development team.

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 reading components.js and components.json to understand how supported languages and plugins are represented. Compare exposing the proposed API from components.js with making components.json public, including the browser and NodeJS use cases described. Done means the chosen public approach supports checking an item and querying supported languages and plugins.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.