Lightweight, robust, elegant syntax highlighting.
Installations
npm install prismjs
Score
98.9
Supply Chain
87.6
Quality
82.5
Maintenance
100
Vulnerability
100
License
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
>=6
Typescript Support
No
Node Version
16.11.1
NPM Version
7.24.2
Statistics
12,342 Stars
3,604 Commits
1,292 Forks
118 Watching
9 Branches
373 Contributors
Updated on 28 Nov 2024
Bundle Size
18.68 kB
Minified
6.92 kB
Minified + Gzipped
Languages
JavaScript (78.65%)
HTML (17.5%)
CSS (3.73%)
C (0.04%)
Terra (0.03%)
Shell (0.02%)
C++ (0.02%)
Awk (0.01%)
Total Downloads
Cumulative downloads
Total Downloads
1,601,665,945
Last day
-7.1%
1,338,233
Compared to previous day
Last week
1.5%
7,618,635
Compared to previous week
Last month
6.7%
32,553,540
Compared to previous month
Last year
-6%
372,587,702
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
33
Prism
Prism is a lightweight, robust, and elegant syntax highlighting library. It's a spin-off project from Dabblet.
You can learn more on prismjs.com.
Why another syntax highlighter?
Contribute to Prism!
Important Notice
We are currently working on Prism v2 and will only accept security-relevant PRs for the time being.
Once work on Prism v2 is sufficiently advanced, we will accept PRs again. This will be announced on our Discussion page and mentioned in the roadmap discussion.
Prism v1 contributing notes
Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, consider giving back by sending a pull request. Here are a few tips:
- Read the documentation. Prism was designed to be extensible.
- Do not edit
prism.js
, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in thecomponents/
folder.prism.js
and all minified files are generated by our build system (see below). - Use
npm ci
to install Prism's dependencies. Do not usenpm install
because it will cause non-deterministic builds. - The build system uses gulp to minify the files and build
prism.js
. With all of Prism's dependencies installed, you just need to run the commandnpm run build
. - Please follow the code conventions used in the files already. For example, I use tabs for indentation and spaces for alignment. Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc.
- Please try to err towards more smaller PRs rather than a few huge PRs. If a PR includes changes that I want to merge and also changes that I don't, handling it becomes difficult.
- My time is very limited these days, so it might take a long time to review bigger PRs (small ones are usually merged very quickly), especially those modifying the Prism Core. This doesn't mean your PR is rejected.
- If you contribute a new language definition, you will be responsible for handling bug reports about that language definition.
- If you add a new language definition or plugin, you need to add it to
components.json
as well and rebuild Prism by runningnpm run build
, so that it becomes available to the download build page. For new languages, please also add a few tests and an example in theexamples/
folder. - Go to prism-themes if you want to add a new theme.
Thank you so much for contributing!!
Software requirements
Prism will run on almost any browser and Node.js version but you need the following software to contribute:
- Node.js >= 10.x
- npm >= 6.x
Translations
- 简体ä¸æ–‡ (if unavailable, see here)
Stable Version
The latest stable version of the package.
Stable Version
1.29.0
HIGH
4
0/10
Summary
Denial of service in prismjs
Affected Versions
< 1.23.0
Patched Versions
1.23.0
7.5/10
Summary
Cross-site Scripting in Prism
Affected Versions
>= 1.14.0, < 1.27.0
Patched Versions
1.27.0
7.4/10
Summary
Regular Expression Denial of Service (ReDoS) in Prism
Affected Versions
< 1.24.0
Patched Versions
1.24.0
7.1/10
Summary
Cross-Site Scripting in Prism
Affected Versions
>= 1.1.0, < 1.21.0
Patched Versions
1.21.0
MODERATE
1
6.5/10
Summary
prismjs Regular Expression Denial of Service vulnerability
Affected Versions
< 1.25.0
Patched Versions
1.25.0
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no binaries found in the repo
Reason
Found 21/28 approved changesets -- score normalized to 7
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/danger.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/danger.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/PrismJS/prism/test.yml/master?enable=pin
- Info: 0 out of 9 GitHub-owned GitHubAction dependencies pinned
- Info: 5 out of 5 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/danger.yml:1
- Info: topLevel 'contents' permission set to 'read': .github/workflows/test.yml:10
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
- Warn: branch protection not enabled for branch 'gh-pages'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 29 are checked with a SAST tool
Reason
39 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-jc84-3g44-wf2q
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-8gh8-hqwg-xf34
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-8cf7-32gw-wr33
- Warn: Project is vulnerable to: GHSA-hjrf-2m68-5959
- Warn: Project is vulnerable to: GHSA-qwph-4952-7xr6
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vp56-6g26-6827
- Warn: Project is vulnerable to: GHSA-x77j-w7wf-fjmw
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-rjqq-98f6-6j3r
- Warn: Project is vulnerable to: GHSA-mjxr-4v3x-q3m4
- Warn: Project is vulnerable to: GHSA-cgfm-xwp7-2cvr
- Warn: Project is vulnerable to: GHSA-rm97-x556-q36h
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-9p95-fxvg-qgq2
- Warn: Project is vulnerable to: GHSA-9w5j-4mwv-2wj8
- Warn: Project is vulnerable to: GHSA-mxhp-79qh-mcx6
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
- Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
4
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More