Skip to content
Lightweight, robust, elegant syntax highlighting.
Branch: master
Clone or download
mkaz and mAAdhaTTah Add className option for toolbar items (#1951)
Allows for passing in a className when registering a toolbar button to allow to target via CSS.

An example:
   Prism.plugins.toolbar.registerButton( 'my-button', {
        text: 'My Button',
        className: 'my-button',
This will add the span element `<span class="my-button">My Button</span>` .
Latest commit 5ab28bb Jun 25, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Clearer description for the highlighting bug report template (#1850) Mar 31, 2019
components Markdown: Added support for complexly nested bold and italic expressions Jun 24, 2019
examples Resolved conflicts Jun 12, 2019
img Update "Used by" section (#1330) Mar 7, 2018
plugins Add className option for toolbar items (#1951) Jun 25, 2019
scripts Fixed download page (#1811) Mar 24, 2019
templates Use HTTPS / canonical URLs (#1390) Apr 16, 2018
tests Markdown: Added support for complexly nested bold and italic expressions Jun 24, 2019
themes Themes: Normalized the font-size of pre and code (#1791) Mar 5, 2019
.editorconfig Set default indentation size (#1516) Aug 19, 2018
.gitattributes Add .gitattributes to prevent line ending changes in test files Aug 18, 2015
.gitignore add Io syntax (#1251) Jan 2, 2018
.npmignore Adjusted .npmignore (#1834) Mar 24, 2019
.travis.yml Travis: Fail when changed files are detected (#1819) Mar 24, 2019 CHANGELOG for v1.16.0 Mar 24, 2019
CNAME Create CNAME May 31, 2018
LICENSE Fixing to initial copyright year Jan 18, 2016 Readme: Minor changes (#1857) Apr 23, 2019
bower.json Ignore tests directory in bower.json Apr 6, 2016
components.js Resolved conflicts Jun 12, 2019
components.json Resolved conflicts Jun 12, 2019
composer.json Name in composer.json set to lowercase (#1824) Mar 24, 2019
download.html Download page: Fixed Edge's word wrap (#1920) Jun 25, 2019
examples.html Added scripts directory (#1781) Mar 10, 2019
extending.html Docs: Added "Creating a new language definition" section (#1925) Jun 1, 2019
faq.html Added scripts directory (#1781) Mar 10, 2019
favicon.png Optimize images (#1007) Jul 29, 2016
gulpfile.js gulp: JSON formatting for partly generated files (#1933) Jun 8, 2019
index.html New tutorial for Drupal (#1859) Apr 8, 2019
logo.svg Website: remove width and height on logo.svg, so it becomes scalable. C… Sep 9, 2017
package-lock.json 1.16.0 Mar 24, 2019
package.json Tests: Added test for empty regexes (#1847) Apr 22, 2019
prism.js JS: Added support for numeric separators (#1895) May 18, 2019
style.css Updated website table of contents styles (#1681) Jan 3, 2019
test-suite.html npm: Fixed `test` script (#1809) Mar 14, 2019
test.html The test page now uses prism-core.js instead of prism.js (#1908) Jun 8, 2019


Build Status

Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from Dabblet.

You can learn more on

Why another syntax highlighter?

More themes for Prism!

Contribute to Prism!

Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering 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 the components/ folder. The minified files are also generated automatically.
  • The build system uses gulp to minify the files and build prism.js. Having gulp installed, you just need to run the command gulp.
  • 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 few huge PRs. If a PR includes changes I want to merge and changes I don't, handling it becomes difficult.
  • My time is very limited these days, so it might take a long time to review longer PRs (short 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, theme or plugin, you need to add it to components.json as well and rebuild Prism by running gulp, so that it becomes available to the download build page. For new languages, please also add a few tests and an example in the examples/ folder.

Thank you so much for contributing!!


  • 中文说明
You can’t perform that action at this time.