/prism-api-plugin

Jenkins API Plugin for Prism

Primary LanguageJavaMIT LicenseMIT

Prism Jenkins Plugin

Jenkins GitHub Actions GitHub pull requests

Provides Prism for Jenkins Plugins. Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s used in millions of websites, including some of those you visit daily.

Additionally, this plugin provides:

  • A global theme configuration that will be used by all source code views:

Themes selection
  • Support for Jenkins dark theme:

Dark Prism theme in Jenkins
  • A default source code rendering view (see SourceCodeViewModel) that can be used in a Jenkins plugin to show the source code in a separate page. This page renders the source code with the configured theme.

Grid layout in Jenkins
  • A configuration of permitted source code directories on agents. So Jenkins will not show sensitive files by accident.

Grid layout in Jenkins

How to use the plugin

In order to use this JS library, add a maven dependency to your pom:

<dependency>
  <groupId>io.jenkins.plugins</groupId>
  <artifactId>prism-api</artifactId>
  <version>[latest version]</version>
</dependency>

Then you can use Prism in your jelly files using the following snippet:

<st:adjunct includes="io.jenkins.plugins.prism"/>

Examples

Currently, no additional help is available for this plugin. You can have a look into the warnings plugin that uses the SourceCodeViewModel to render the source code with the selected warning.