Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/frugal/docs/dep/prism.ts

A frugal web framework
Go to Latest
import * as frugal from "https://deno.land/x/frugal@0.5.0/docs/dep/prism.ts";

Variables

By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses addEventListener to communicate with its parent instance. However, if you're using Prism manually in your own worker, you don't want it to do this.

By default, Prism will attempt to highlight all code elements (by calling Prism.highlightAll) on the current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load additional languages or plugins yourself.

Functions

Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language definitions to use, and returns a string with the HTML produced.

This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and then calls Prism.highlightElement on each one of them.

Fetches all the descendants of container that have a .language-xxxx class and then calls Prism.highlightElement on each one of them.

Highlights the code inside a single element.

This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input and the language definitions to use, and returns an array with the tokenized code.

Interfaces

The expansion of a simple RegExp literal to support additional properties.

Type Aliases

A function which will be invoked after an element was successfully highlighted.