Get Started

Configuration

You can customise Prism’s settings using a PHP configuration file. This is optional: each setting has a default, so you only need to include the values you want to change.

To override a setting, create prism.php in your Craft project’s /config directory and return an array of setting names and values. For example, the following will show line numbers in the editor:

<?php

return [
    'editorLineNumbers' => true,
];

All other settings keep their defaults. Add any further settings you want to change to the same array. The options below explain the available settings and their defaults. You can also manage many of these settings in the control panel under Settings → Prism.

Configuration Options

editorTheme

Choose an editor theme.

editorLanguage

Choose a default syntax to highlight text with.

editorHeight

Set the default number of rows the editor will be displayed at.

editorTabWidth

Set the tab width. This uses the experimental CSS property tab-size.

editorLineNumbers

Choose whether line numbers are displayed or not.

customThemesDir

The path to a directory of custom theme CSS files. The Theme setting only lists the bundled themes, so a custom theme in this directory can't currently be selected for a field.

Available Themes and Languages

Every Prism field offers the same choices, which are the eight themes and 176 languages bundled with PrismJS. Each field uses one theme and highlights one language, set in its field settings.