Syntax

Add styled code snippets to your pages, allowing you to share your expertise and code with others, create tutorials, provide examples and much more.

Examples

CSS Example
/* CSS Comment */
.class-name {
    color: #000000;
    background-color: #ffffff;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
}
HTML Example
<!-- HTML Comment -->
<ul>
    <li>Potato</li>
    <li>Ginger</li>
    <li>Beetroot</li>
    <li>Carrot</li>
    <li>Squash</li>
</ul>
Javascript Example
// Javascript Comment
function changeColor(newColor) {
    const elem = document.getElementById('myid');
    elem.style.color = newColor;
}
Swift Example
// Swift Comment
private var imageName: String
var image: Image {
    Image(imageName)
}

You take the red pill... you stay in Wonderland, and I show you how deep the rabbit hole goes.

The Syntax tool provides a great way to share code snippets with your visitors. Whether you're providing training, tutorials or something else, you'll have a beautiful way to stylistically share your code.

You can select from a large list of code languages, and have granular control over how each is displayed on the page.

Settings

Edit Mode

Edit Mode Title

Allows you to add a custom label to the top title bar of the tool. This lets you quickly identify what purpose you're using that tool for in your layout. This title is also visible when you've collapsed or hidden the contents of the tool in Edit Mode.

Title

Title

When enabled a small text title will be added to the top of the Syntax code tool's display. This optional text allows you to label the code for your visitors if you wish.

Title Style

Allows you to use one of Foundry's presets from the color palette or extended color palette, as well as the grey, white and dark preset values for the main Title text. You're also provided an option to choose a custom one-off color as well.

Background

Background

Allows you to use one of Foundry's presets from the color palette or extended color palette, as well as the grey, white and dark preset values for the Syntax tool's Background. You're also provided an option to choose a custom one-off color as well.

Line Numbers

Line Numbers

When enabled Syntax will add a line number, for reference purposes, to the start of each line of code.

Line Number Style

Allows you to use one of Foundry's presets from the color palette or extended color palette, as well as the grey, white and dark preset values for the optional Line Numbers. You're also provided an option to choose a custom one-off color as well.

Line Numbers Divider

Using this feature adds a divider line between the line numbers and the code within Syntax.

Divider Style

Allows you to use one of Foundry's presets from the color palette or extended color palette, as well as the grey, white and dark preset values for the optional Line Numbers Divider line. You're also provided an option to choose a custom one-off color as well.

Alternating Striped Lines

You can enable this feature to add background coloring to alternating rows within your code. This makes for better legibility for your visitors.

Stripes Style

When the Alternating Stiped Lines feature is in use you can use these two color pickers for styling the odd and even line backgrounds.

Line Hover Indicator

Enabling this setting will cause the line background color to change when a visitor hovers over a line of code within Syntax.

Hover Style

This color picker allows you to customize the background color used for the Line Hover Indicator feature above, when enabled.

Code Text

Language

Here you'll choose the language type for the code that you'll be using in this instance of Syntax. This tells the code parser which language it should interpert your input as so it can properly style it for you.

Code Text Styling

In this section you will find color pickers and font weight controls for various aspects of the code styling within the Syntax tool. You can fully customize the code styling here using these controls and color pickers.

Decorative Dots

Deocrative Dots

We've included some decorative dots in the upper left corner to simulate an OS or browser window. These are on by default but you can disable them if you don't wish to use them.

Dots

These three color pickers allow you to custom style the Decorative Dots if you've got them enabled, above.

Shadow

Shadow

Used to add a decorative shadow to the button. Foundry provides a variety of preset shadow styles, as well as access to a user defined preset that you can configure in the Control Center. Additionally for one-off shadows there is also a custom shadow option where you can create a unique shadow style, setting its positioning, size, spread and color.

HTML Comment

HTML Comment

Enabling this feature adds an HTML comment to the exported code to indicate the name of the tool being used here. This is helpful to both yourself and others when troubleshooting, or inspecting the code. This is enabled by default.

Custom

This field allows you to replace the default HTML Comment with your own text.

CSS

Classes

Allows you to specify an options class, or classes, that will be added to this tool's wrapper. You can use this to apply custom styling from the Blacksmith tool, or add a Bootstrap v5 preset class to your item. If you're applying more than one class be sure that you separate each class name with a space. Do not use special characters.