### Basic Download Button Setup Source: https://github.com/prismjs/prism/blob/v2/src/plugins/download-button/README.md Use the `data-src` and `data-download-link` attributes on a `
` element to enable the download button. This is the basic setup for the plugin.

```html

```

--------------------------------

### Include WebPlatform Docs Plugin

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/wpd/README.md

No setup required, just include the plugin in your download.

```markup

```

```markup

```

```markup

```

```markup

```

--------------------------------

### Stylus Previewer Examples

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

Presents examples of how previewers function with Stylus syntax, covering gradients, angles, colors, easing functions, and time durations. It showcases various gradient types and transform properties.

```stylus
gradient = linear-gradient(135deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%)
.example-gradient
	background-image: repeating-radial-gradient(circle, rgba(255, 0, 0, 0), rgba(255, 0, 0, 1) 10px, rgba(255, 0, 0, 0) 20px)
angle = 357deg
.example-angle
	transform: rotate(100grad)
color = olive
.example-color
	color: #000
easing = ease-in
.example-easing
	transition-timing-function: ease-out
time = 3s
.example-time
	transition-duration: 0.5s

```

--------------------------------

### Sass Previewer Examples

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

Shows how previewers work with Sass variables and mixins for gradients, angles, colors, easing functions, and time durations. Includes various gradient and transform examples.

```sass
$gradient: linear-gradient(135deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%)
@mixin example-gradient
	background: -moz-radial-gradient(center, ellipse cover, #f2f6f8 0%, #d8e1e7 50%, #b5c6d0 51%, #e0eff9 100%)
	background: radial-gradient(ellipse at center, #f2f6f8 0%, #d8e1e7 50%, #b5c6d0 51%, #e0eff9 100%)
$angle: 380grad
@mixin example-angle
	transform: rotate(-120deg)
.example-angle
	transform: rotate(18rad)
$color: blue
@mixin example-color
	color: rgba(147, 32, 34, 0.8)
.example-color
	color: pink
$easing: ease-out
.example-easing
	transition-timing-function: ease-in-out
$time: 3s
@mixin example-time
	transition-duration: 800ms
.example-time
	transition-duration: 0.8s

```

--------------------------------

### Basic Object Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/normalize-whitespace/demo.md

A simple JavaScript object example demonstrating basic structure.

```javascript
let example = {
	foo: true,

	bar: false
};

```

--------------------------------

### CSS Previewer Examples

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

Demonstrates various CSS properties that trigger previewers for gradients, angles, colors, easing functions, and time durations. These examples showcase different syntaxes and browser prefixes for gradients.

```css
.example-gradient {
	background: -webkit-linear-gradient(left,     #cb60b3 0%, #c146a1 50%, #a80077 51%, #db36a4 100%); /* Chrome10+, Safari5.1+ */
	background:    -moz-linear-gradient(left,     #cb60b3 0%, #c146a1 50%, #a80077 51%, #db36a4 100%); /* FF3.6+ */
	background:     -ms-linear-gradient(left,     #cb60b3 0%, #c146a1 50%, #a80077 51%, #db36a4 100%); /* IE10+ */
	background:      -o-linear-gradient(left,     #cb60b3 0%, #c146a1 50%, #a80077 51%, #db36a4 100%); /* Opera 11.10+ */
	background:         linear-gradient(to right, #cb60b3 0%, #c146a1 50%, #a80077 51%, #db36a4 100%); /* W3C */
}
.example-angle {
	transform: rotate(10deg);
}
.example-color {
	color: rgba(255, 0, 0, 0.2);
	background: purple;
	border: 1px solid hsl(100, 70%, 40%);
}
.example-easing {
	transition-timing-function: linear;
}
.example-time {
	transition-duration: 3s;
}
```

--------------------------------

### Show Invisibles HTML Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/show-invisibles/README.md

An example HTML structure demonstrating the use of Prism.js with the Show Invisibles plugin.

```html



	Show Invisibles Example
	
	



// This is a comment with tabs:	
// And some spaces:    
// And a newline:
``` -------------------------------- ### Line Highlight with Line Numbers Plugin Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md Shows compatibility with the Line Numbers plugin. This example highlights line 1 and starts line numbering from -5. ```markup

```

--------------------------------

### HTML Example with Links

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autolinker/README.md

Demonstrates autolinking of URLs in HTML comments, attributes, and raw text content.

```html

In attributes too!

Autolinking in raw text: https://prismjs.com

``` -------------------------------- ### Line Numbers with Custom Start (HTML) Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-numbers/README.md Use the 'data-start' attribute on the pre element to specify a custom starting line number. This example starts numbering from -5. ```html

```

--------------------------------

### Scss Previewer Examples

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

Demonstrates the integration of previewers with Scss, utilizing variables and interpolation for properties like background-image, transform, color, transition-timing-function, and transition-duration.

```scss
$gradient: linear-gradient(135deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%);
$attr: background;
.example-gradient {
	#{$attr}-image: repeating-linear-gradient(10deg, rgba(255, 0, 0, 0), rgba(255, 0, 0, 1) 10px, rgba(255, 0, 0, 0) 20px);
}
$angle: 1.8turn;
.example-angle {
	transform: rotate(-3rad)
}
$color: blue;
.example-color {
	#{$attr}-color: rgba(255, 255, 0, 0.75);
}
$easing: linear;
.example-easing {
	transition-timing-function: cubic-bezier(0.9, 0.1, .2, .4);
}
$time: 1s;
.example-time {
	transition-duration: 10s
}
```

--------------------------------

### JavaScript Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/match-braces/README.md

A basic JavaScript function demonstrating brace usage.

```js
const func = (a, b) => {
	return `${a}:${b}`;
}
```

--------------------------------

### Example of Normalized Whitespace

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/normalize-whitespace/README.md

This example shows how code blocks are rendered after whitespace normalization, including trimming, indenting, and line breaking.

```javascript

		let example = {
			foo: true,

			bar: false
		};


		let
		there_is_a_very_very_very_very_long_line_it_can_break_it_for_you
		 = true;
		
		if 
		(there_is_a_very_very_very_very_long_line_it_can_break_it_for_you
		 === true) {
		};

	
```

--------------------------------

### Example: Prefix and map classes

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/custom-class/README.md

Illustrates the combined effect of prefixing and mapping classes on code tokens, showing the transformation from input HTML to output with custom classes.

```javascript
Prism.plugins.customClass.map({
	keyword: 'special-keyword',
	string: 'my-string'
});
Prism.plugins.customClass.prefix('pr-');
```

--------------------------------

### Handling Non-existent Files

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/file-highlight/README.md

Example showing how an empty `
` tag is rendered when the file specified in `data-src` does not exist.

```html

```

--------------------------------

### CSS Example with URL

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autolinker/README.md

Illustrates how URLs within CSS, specifically in `url()` functions, are autolinked.

```css
@font-face {
	src: url(https://lea.verou.me/logo.otf);
	font-family: 'LeaVerou';
}
```

--------------------------------

### Plugin JavaScript File

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/file-highlight/README.md

Example of loading the plugin's own JavaScript file using `data-src`.

```html

```

--------------------------------

### Lisp Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/match-braces/README.md

A Lisp function for calculating factorial.

```lisp
(defun factorial (n)
	(if (= n 0) 1
		(* n (factorial (- n 1)))))

```

--------------------------------

### Custom Keyword CSS Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/highlight-keywords/README.md

Example CSS rule to style specific keywords like 'if' and 'return' with custom colors. You need to define these rules yourself as the plugin does not include styles.

```css
.token.keyword.keyword-return, .token.keyword.keyword-if {
	/* Set the color to a nice red. */
	color: #f92672;
}
```

--------------------------------

### Less Previewer Examples

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

Illustrates the use of previewers with Less variables and properties for gradients, angles, colors, easing functions, and time durations. Includes vendor-prefixed gradients.

```less
@gradient: linear-gradient(135deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%);
.example-gradient {
	background: -webkit-linear-gradient(-45deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* Chrome10+, Safari5.1+ */
	background:    -moz-linear-gradient(-45deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* FF3.6+ */
	background:     -ms-linear-gradient(-45deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* IE10+ */
	background:      -o-linear-gradient(-45deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* Opera 11.10+ */
	background:         linear-gradient(135deg, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* W3C */
}
@angle: 3rad;
.example-angle {
	transform: rotate(.4turn)
}
@nice-blue: #5B83AD;
.example-color {
	color: hsla(102, 53%, 42%, 0.4);
}
@easing: cubic-bezier(0.1, 0.3, 1, .4);
.example-easing {
	transition-timing-function: ease;
}
@time: 1s;
.example-time {
	transition-duration: 2s;
}
```

--------------------------------

### Highlight with Line Number Offset

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md

Use `data-line-offset` to adjust the starting line number for highlighting. This example highlights line 43 but starts numbering from line 41.

```markup

```

--------------------------------

### JavaScript Example with Links

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autolinker/README.md

Shows various types of links (URLs, emails, Markdown links) within JavaScript comments and code.

```javascript
/**
 * Prism: Lightweight, robust, elegant syntax highlighting
 * MIT license https://www.opensource.org/licenses/mit-license.php/
 * @author Lea Verou https://lea.verou.me
 * Reach Lea at fake@email.com (no, not really)
 * And this is [a Markdown link](https://prismjs.com). Sweet, huh?
 */
let foo = 5;
// And a single line comment https://google.com
```

--------------------------------

### Markup Attribute Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

Shows how previewers can be triggered by values within HTML attributes, such as 'bgcolor' and 'style'.

```html


```

--------------------------------

### Plain Text Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/show-language/README.md

Demonstrates how plain text content is handled, showing that the language label is not displayed for non-code content.

```none
Just some text (aka. not code).
```

--------------------------------

### Full HTML Example with script type="text/plain"

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/unescaped-markup/README.md

A complete HTML document demonstrating the use of `
```

--------------------------------

### Command Line with Specific Output Lines

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/command-line/README.md

Display command output by specifying line numbers or ranges in the `data-output` attribute. Lines are counted from the start of the code block.

```html
```bash { .command-line data-user="chris" data-host="remotehost" data-output="2, 4-8" }
pwd
/usr/home/chris/bin
ls -la
total 2
drwxr-xr-x   2 chris  chris     11 Jan 10 16:48 .
drwxr--r-x  45 chris  chris     92 Feb 14 11:10 ..
-rwxr-xr-x   1 chris  chris    444 Aug 25  2013 backup
-rwxr-xr-x   1 chris  chris    642 Jan 17 14:42 deploy
```
``` -------------------------------- ### Node.js Usage of Normalize Whitespace Source: https://github.com/prismjs/prism/blob/v2/src/plugins/normalize-whitespace/README.md Use the Normalize Whitespace plugin in a Node.js environment. This example shows how to import and use the plugin for server-side code processing. ```javascript let Prism = require("prismjs"); let Normalizer = require("prismjs/plugins/normalize-whitespace/normalize-whitespace"); // Create a new Normalizer object let nw = new Normalizer({ "remove-trailing": true, "remove-indent": true, "left-trim": true, "right-trim": true, /*"break-lines": 80, "indent": 2, "remove-initial-line-feed": false, "tabs-to-spaces": 4, "spaces-to-tabs": 4*/ }); // ..or use the default object from Prism nw = Prism.plugins.NormalizeWhitespace; // The code snippet you want to highlight, as a string let code = "\t\t\tlet data = 1; "; // Removes leading and trailing whitespace // and then indents by 1 tab code = nw.normalize(code, { // Extra settings indent: 1 }); // Returns a highlighted HTML string let html = Prism.highlight(code, Prism.languages.javascript); ``` -------------------------------- ### Markdown with C# Highlighting Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autoloader/README.md Example of C# code embedded within Markdown. The autoloader will load the C# grammar if it's not already present. ```markdown The C# code will be highlighted __after__ the rest of this document. ```csharp public class Foo : IBar { public string Baz { get; set; } = "foo"; } ``` The CSS code will be highlighted with this document because CSS has already been loaded. ```css a:hover { color: green !important; } ``` ``` -------------------------------- ### CSS Rule for 'if' Keyword Source: https://github.com/prismjs/prism/blob/v2/src/plugins/highlight-keywords/README.md Demonstrates a CSS rule to apply specific highlighting to the 'if' keyword. This is an example of how to target keywords using the classes added by the plugin. ```css .token.keyword.keyword-if { /* styles for 'if' */ } ``` -------------------------------- ### JavaScript Code Snippet Example Source: https://github.com/prismjs/prism/blob/v2/src/plugins/copy-to-clipboard/README.md A JavaScript code snippet with a custom copy message, intended to be copied to the clipboard. ```js console.log('Hello, world!'); ``` -------------------------------- ### Line Numbers for Raw Text Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-numbers/README.md The Line Numbers plugin can be applied to any content, even if it's not syntax-highlighted. This example shows line numbers applied to raw text. ```none ```{ .language-none .line-numbers } This raw text is not highlighted but it still has line numbers ``` ``` -------------------------------- ### Highlight Line Range Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md Specify a range of lines to highlight using the `data-line` attribute with a hyphen. This example highlights lines 15 through 25. ```markup

```

--------------------------------

### Highlight Multiple Lines and Ranges

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md

Combine single lines and ranges in the `data-line` attribute, separated by commas. This example highlights line 1, lines 3-4, and line 42.

```markup

```

--------------------------------

### Highlight Specific Line

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md

Use the `data-line` attribute to highlight a single line in a code block. This example targets line 2.

```markup

```

--------------------------------

### CSS with Data URI Example

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/data-uri-highlight/README.md

Demonstrates how to use a data-URI within a CSS `border-image` property. The content of the data-URI is an SVG, which will be highlighted if the SVG grammar is loaded.

```css
div {
    border: 40px solid transparent;
    border-image: 33.334% url('data:image/svg+xml, \
                           \
                           \
                           \
                           \
                          ');
    padding: 1em;
    max-width: 20em;
    font: 130%/1.6 Baskerville, Palatino, serif;
}
```

--------------------------------

### Linking to Specific Lines

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md

Demonstrates how to link to specific lines within a code block using a URL hash format: `#{element-id}.{lines}`. This example links to lines 50-55 and 60.

```markup
[Linking example](#play.50-55,60)
```

--------------------------------

### Line Highlight with Embedded Content

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-highlight/README.md

Illustrates line highlighting when the code block contains additional content before the `` element. This example highlights line 7.

```markup
Some content

``` -------------------------------- ### Line Range Examples Source: https://github.com/prismjs/prism/blob/v2/src/plugins/file-highlight/README.md The `data-range` attribute supports various formats including single lines, open ranges, and negative integers for counting from the end of the file. ```html

```

```html

```

```html

```

--------------------------------

### Setting Default Options

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/normalize-whitespace/demo.md

Configures the Normalize Whitespace plugin with default options for removing trailing whitespace, indentation, and trimming lines. This setup applies globally to all subsequent code blocks processed by Prism.

```javascript
Prism.plugins.NormalizeWhitespace.setDefaults({
	"remove-trailing": true,
	"remove-indent": true,
	"left-trim": true,
	"right-trim": true,
});

```

--------------------------------

### Load Prism and Custom Class Plugin

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/custom-class/README.md

Demonstrates the correct order for loading Prism.js, the Custom Class plugin, and then calling its feature functions to ensure proper initialization.

```html






```

--------------------------------

### Basic Command Line Usage

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/command-line/README.md

Use this snippet to display a simple command line interface. Add the 'command-line' class to your `
` tag.

```html
```
cd ~/.vim

vim vimrc
```
``` -------------------------------- ### PowerShell with Output Source: https://github.com/prismjs/prism/blob/v2/src/plugins/command-line/README.md Demonstrates a PowerShell command with its output, using data-output to specify the lines to be shown. ```html
```
```

```powershell
dir


    Directory: C:\Users\Chris


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        10/14/2015   5:06 PM            Contacts
d-r--        12/12/2015   1:47 PM            Desktop
d-r--         11/4/2015   7:59 PM            Documents
d-r--        10/14/2015   5:06 PM            Downloads
d-r--        10/14/2015   5:06 PM            Favorites
d-r--        10/14/2015   5:06 PM            Links
d-r--        10/14/2015   5:06 PM            Music
d-r--        10/14/2015   5:06 PM            Pictures
d-r--        10/14/2015   5:06 PM            Saved Games
d-r--        10/14/2015   5:06 PM            Searches
d-r--        10/14/2015   5:06 PM            Videos
```

--------------------------------

### SQL Line Continuation with Output and Continuation Filtering

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/command-line/README.md

Illustrates SQL line continuation with custom prompts and filters for both output and continuation lines.

```html
```
```

```sql
set @my_var = 'foo';
set @my_other_var = 'bar';
(out)
CREATE TABLE people (
(con)first_name VARCHAR(30) NOT NULL,
(con)last_name VARCHAR(30) NOT NULL
(con));
(out)Query OK, 0 rows affected (0.09 sec)
(out)
insert into people
(con)values ('John', 'Doe');
(out)Query OK, 1 row affected (0.02 sec)
(out)
select *
(con)from people
(con)order by last_name;
(out)+------------+-----------+
(out)| first_name | last_name |
(out)+------------+-----------+
(out)| John       | Doe       |
(out)+------------+-----------+
(out)1 row in set (0.00 sec)
```

--------------------------------

### Highlighting the Current Page

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/file-highlight/README.md

Demonstrates loading the current HTML file itself using `data-src`.

```html

```

--------------------------------

### Show Invisibles JavaScript

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/show-invisibles/README.md

The JavaScript code for the Show Invisibles plugin. This file should be included in your Prism.js setup.

```javascript
Prism.hooks.add('complete', function (env) {
	if (env.code) {
		var code = env.highlighted;
		
		// Handle tabs
		code = code.replace(/\t/g, '\t');
		
		// Handle spaces
		code = code.replace(/(\s{2,})/g, function (m, spaces) {
			return new Array(spaces.length + 1).join(' ');
		});
		
		// Handle line breaks
		code = code.replace(/\n/g, '\n');
		
		env.highlighted = code;
	}
});
```

--------------------------------

### Root User Command Line

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/command-line/README.md

Configure a root user prompt by setting `data-user="root"` and `data-host` attributes on the `
` tag.

```html
```bash { .command-line data-user="root" data-host="localhost" }
cd /usr/local/etc
cp php.ini php.ini.bak
vi php.ini
```
``` -------------------------------- ### Using Built-in Adapters Source: https://github.com/prismjs/prism/blob/v2/src/plugins/jsonp-highlight/README.md When no `data-adapter` is specified, the plugin attempts to use its built-in adapters (e.g., for GitHub, Gists, Bitbucket) to parse the JSONP response. ```html

```

--------------------------------

### Copy to Clipboard with Inherited Settings

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/copy-to-clipboard/README.md

Shows how copy settings can be inherited from ancestor elements, with the closest ancestor's attribute taking precedence.

```html

	
int main() {
	return 0;
}
``` -------------------------------- ### Basic Diff Highlight Source: https://github.com/prismjs/prism/blob/v2/src/plugins/diff-highlight/README.md Use `class="language-diff"` to highlight standard diff blocks. This is the most basic usage for displaying differences. ```diff @@ -4,6 +4,5 @@ - let foo = bar.baz([1, 2, 3]); - foo = foo + 1; + const foo = bar.baz([1, 2, 3]) + 1; console.log(`foo: ${foo}`); ``` -------------------------------- ### CSS Color Previews Source: https://github.com/prismjs/prism/blob/v2/src/plugins/inline-color/README.md Demonstrates how the plugin renders inline previews for various CSS color formats like named colors, hex codes, RGB, and HSL. ```css span.foo { background-color: navy; color: #BFD; } span.bar { background: rgba(105, 0, 12, .38); color: hsl(30, 100%, 50%); border-color: transparent; } ``` -------------------------------- ### Basic Usage with GitHub API Source: https://github.com/prismjs/prism/blob/v2/src/plugins/jsonp-highlight/README.md Use the `data-jsonp` attribute on a `
` element to fetch and highlight JavaScript code from a GitHub repository. The plugin automatically adds the `callback` query parameter.

```html

```

--------------------------------

### Using a Custom Adapter via `data-adapter` Attribute

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/jsonp-highlight/README.md

Define a global JavaScript function (e.g., `dump_json`) and reference it using the `data-adapter` attribute on the `
` element. This function will be used to parse the JSONP response.

```javascript
function dump_json (rsp) {
		return "using dump_json: " + JSON.stringify(rsp, null, 2);
	}
```

```html


```

--------------------------------

### Add Custom Language Filter

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/filter-highlight-all/README.md

Adds a custom function to filter elements. Only elements for which the function returns true will be highlighted. This example prevents CSS code from being highlighted.

```javascript
Prism.plugins.filterHighlightAll.add(function (env) {
	return env.language !== 'css';
});
```

--------------------------------

### Download Button for HTML File

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/download-button/README.md

Demonstrates enabling the download button for an HTML file. The `data-src` attribute points to the HTML file to be downloaded.

```html

```

--------------------------------

### PowerShell Line Continuation with Output Filtering

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/command-line/README.md

Demonstrates PowerShell line continuation using a backtick and filters output.

```html
```
```

```powershell
Write-Host `
'Hello' `
'from' `
'PowerShell!'
(out)Hello from PowerShell!
Write-Host 'Goodbye from PowerShell!'
(out)Goodbye from PowerShell!
```

--------------------------------

### Basic Usage with data-src

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/file-highlight/README.md

Use the `data-src` attribute on an empty `
` element to specify the file to be highlighted. The language is auto-detected from the file extension.

```html

```

--------------------------------

### Line Numbers Plugin Initialization (JavaScript)

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-numbers/README.md

This snippet shows how to include the Line Numbers plugin script. It's typically used in conjunction with the PrismJS core library.

```javascript

```

--------------------------------

### Line Numbers Plugin Initialization (CSS)

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/line-numbers/README.md

This snippet demonstrates how the Line Numbers plugin can be applied to a CSS file. The parent element must have the 'line-numbers' class.

```css

```

--------------------------------

### Basic Perl Code Highlighting

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autoloader/README.md

Demonstrates basic code highlighting for Perl. The autoloader will fetch the Perl grammar if it's not already loaded.

```perl
my ($class, $filename) = @_; 

```

--------------------------------

### File Highlight with Line Numbers

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/file-highlight/README.md

Combines the File Highlight plugin with the Line Numbers plugin, specifying a line range and applying the `line-numbers` class.

```html

```

--------------------------------

### Load CSS from Bitbucket API

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/jsonp-highlight/README.md

Loads CSS code from a file hosted on Bitbucket using their API.

```html

```

--------------------------------

### Normalize Whitespace with Keep Markup Plugin

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/normalize-whitespace/README.md

Demonstrates compatibility with the keep-markup plugin, showing how marked sections are preserved during whitespace normalization.

```css


@media screen {
	div {
		text-decoration: underline;
		background: url('foo.png');
	}
}
```

--------------------------------

### Prism.plugins.Previewer Constructor

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/previewers/README.md

This constructor is used to create new previewers for Prism.js. It allows you to define the token type, an update function, and optionally supported languages and an initializer function.

```APIDOC
## `new Prism.plugins.Previewer(type, updater, supportedLanguages, initializer)`

### Description

This constructor creates a new previewer associated with a specific token type. When a token of the specified type is hovered, the `updater` function is called to potentially display the previewer.

### Parameters

#### Path Parameters

*   **type** (string) - Required - The token type this previewer is associated to. The previewer will be shown when hovering tokens of this type.
*   **updater** (function) - Required - The function that will be called each time an associated token is hovered. This function takes the text content of the token as its only parameter. The previewer HTML element can be accessed through the keyword `this`. This function must return `true` for the previewer to be shown.
*   **supportedLanguages** (array of strings, optional) - An optional array of supported languages. The previewer will be available only for those. Defaults to `'*'`, which means every languages.
*   **initializer** (function, optional) - An optional function. This function will be called when the previewer is initialized, right after the HTML element has been appended to the document body.
```

--------------------------------

### Use Development Versions of Grammars

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autoloader/README.md

Configure the autoloader to use unminified development versions of grammars instead of the default minified ones.

```javascript
Prism.plugins.autoloader.use_minified = false;

```

--------------------------------

### HTML with Inline Styles

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/inline-color/README.md

Shows that the plugin also recognizes and previews color values within inline styles in HTML, as well as within `




```

--------------------------------

### Copy to Clipboard with Custom Messages and Timeout

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/copy-to-clipboard/README.md

Demonstrates how to customize copy messages and set a short timeout using data attributes on the body and pre-code elements.

```html

	
console.log('Hello, world!');
int main() {
	return 0;
}
``` -------------------------------- ### Markdown Link in Comment Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autolinker/README.md Demonstrates how to use Markdown syntax within a comment to create a clickable link. ```markdown [Text you want to see](https://url-goes-here.com) ``` -------------------------------- ### Prism.plugins.filterHighlightAll API Source: https://github.com/prismjs/prism/blob/v2/src/plugins/filter-highlight-all/README.md This section details the methods and properties available within the `Prism.plugins.filterHighlightAll` object for managing highlighting filters. ```APIDOC ## Prism.plugins.filterHighlightAll API ### Description Provides methods to define and manage filters for Prism's automatic code highlighting. ### Methods #### `add(condition: (value: { element, language: string }) => boolean): void` Adds a new filter. An element is only highlighted if the provided function returns `true` for it. #### `addSelector(selector: string): void` Adds a new filter. An element is only highlighted if it matches the provided CSS selector. #### `reject.add(condition: (value: { element, language: string }) => boolean): void` Adds a rejection filter. An element is only highlighted if it does **not** fulfill the provided condition. #### `reject.addSelector(selector: string): void` Adds a rejection filter. An element is only highlighted if it does **not** match the provided CSS selector. ### Properties #### `filterKnown: boolean = false` If set to `true`, only known languages will be highlighted. Code blocks without a set or with an unknown language will be ignored. ### Attributes #### `data-filter-selector=""` Shorthand for `Prism.plugins.filterHighlightAll.addSelector`. The attribute's value is passed directly to `addSelector`. #### `data-reject-selector=""` Shorthand for `Prism.plugins.filterHighlightAll.reject.addSelector`. The attribute's value is passed directly to `reject.addSelector`. #### `data-filter-known` Sets the value of `Prism.plugins.filterHighlightAll.filterKnown` to `true` if the attribute is present. ``` -------------------------------- ### Load Plugin JS from GitHub Source: https://github.com/prismjs/prism/blob/v2/src/plugins/jsonp-highlight/README.md Loads the plugin's JavaScript code directly from GitHub using a JSONP request. ```html

```

--------------------------------

### Map Prism classes using a function

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/custom-class/README.md

Provides more advanced mapping logic, allowing for language-specific class replacements or dynamic class generation based on the original class name and language.

```javascript
Prism.plugins.customClass.map((className, language) => {
	if (language === 'css') {
		return cssSpecificMap[className] || className;
	} else {
		return className;
	}
});
```

--------------------------------

### Include Toolbar CSS

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/show-language/README.md

Includes the necessary CSS for the toolbar plugin, which is a requirement for the Show Language plugin.

```css
@import "../toolbar/toolbar.css";
```

--------------------------------

### Registering a Custom Data Adapter

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/jsonp-highlight/README.md

Register a custom adapter function globally using `Prism.plugins.jsonphighlight.registerAdapter`. This function will be used to parse the JSONP response if no built-in adapters can.

```javascript
Prism.plugins.jsonphighlight.registerAdapter(rsp => {
		return "using registerAdapter: " + JSON.stringify(rsp, null, 2);
	})
```

--------------------------------

### Set Custom Languages Path

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/autoloader/README.md

Specify a custom URL or path for the autoloader to find grammar files if they are not in the default 'components' folder.

```javascript
Prism.plugins.autoloader.languages_path = 'path/to/grammars/';

```

--------------------------------

### Registering a Button with Custom Element and Event Listener

Source: https://github.com/prismjs/prism/blob/v2/src/plugins/toolbar/README.md

Create a custom button element with event listeners by providing a function to `registerButton` that returns a DOM element.

```javascript
Prism.plugins.toolbar.registerButton('select-code', env => {
	let button = document.createElement('button');
	button.innerHTML = 'Select Code';

	button.addEventListener('click', () => {
		// Source: http://stackoverflow.com/a/11128179/2757940
		if (document.body.createTextRange) {
			// ms
			let range = document.body.createTextRange();
			range.moveToElementText(env.element);
			range.select();
		} else if (window.getSelection) {
			// moz, opera, webkit
			let selection = window.getSelection();
			let range = document.createRange();
			range.selectNodeContents(env.element);
			selection.removeAllRanges();
			selection.addRange(range);
		}
	});

	return button;
});
```