Skip to content
Invisible link to canonical for Microformats Syntax highlighting reference

Syntax highlighting reference


Available styles and rendered code specimens

Lookup for highlighting style identifiers and code specimens. The selector previews a style on this page and displays its configuration mapping. For the editing and publishing procedure, use Change code highlighting.

Changing this preview does not save the style on your own website.

None

chulapa-skin:
  highlight:  

Code specimensPermalink to Code specimens

The examples below show the selected stylesheet across code languages.

JavaScriptPermalink to JavaScript

// Label the guides.
const guides = ["Install", "Publish"];
guides.forEach((title, index) => {
  console.log(`${index + 1}. ${title}`);
});

PythonPermalink to Python

from pathlib import Path


def markdown_pages(directory: Path) -> list[str]:
    # Exclude files whose names start with an underscore.
    return sorted(
        page.name for page in directory.glob("*.md")
        if not page.name.startswith("_")
    )


print(markdown_pages(Path("docs")))

CSSPermalink to CSS

/* Make keyboard focus visible. */
.card a:focus-visible {
  outline: 2px solid var(--accent, #0645ad);
}

@media (min-width: 48rem) {
  .card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

SCSSPermalink to SCSS

$accent: #0645ad;

.card {
  padding: 1rem;

  &__title {
    color: $accent;
  }

  &:focus-within {
    box-shadow: 0 0 0 2px rgba($accent, 0.4);
  }
}

JavaPermalink to Java

import java.util.List;

public class PageIndex {
    public static void main(String[] args) {
        // Print the names of the guides.
        for (String title : List.of("Install", "Publish")) {
            System.out.printf("Guide: %s%n", title);
        }
    }
}

C#Permalink to C#

using System;
using System.Linq;

var titles = new[] { "Install", "Publish", "Customize" };
// Select titles that start with a vowel.
var matches = titles.Where(title => "AEIOU".Contains(title[0]));

foreach (var title in matches)
{
    Console.WriteLine($"Guide: {title}");
}

HTMLPermalink to HTML

<!-- Link to the next chapter. -->
<nav aria-label="Series navigation">
  <ol class="chapters">
    <li><a href="/install/" aria-current="page">Install</a></li>
    <li><a href="/publish/">Publish</a></li>
  </ol>
</nav>

RPermalink to R

# Count published pages by section.
pages <- data.frame(
  section = c("Install", "Publish", "Install"),
  published = c(TRUE, FALSE, TRUE)
)

published <- subset(pages, published)
counts <- table(published$section)
print(counts)

RubyPermalink to Ruby

Page = Struct.new(:title, :published, keyword_init: true)

# Keep titles for published pages.
pages = [
  Page.new(title: 'Install', published: true),
  Page.new(title: 'Publish', published: false)
]

pages.select(&:published).each do |page|
  puts "Guide: #{page.title}"
end

PHPPermalink to PHP

<?php
// Choose which guide titles to print.
$guides = ['Install' => true, 'Publish' => false];

foreach ($guides as $title => $published) {
    if ($published) {
        echo "Guide: $title", PHP_EOL;
    }
}

MarkdownPermalink to Markdown

# Install the theme

Use **Settings** to find the publishing controls and edit `_config.yml`
to change the site title.

1. Check the publishing branch.
2. Open the [published site](https://example.org/).

> Preview the site before sharing its URL.

YAMLPermalink to YAML

# Publish a collection of guides.
collections:
  guides:
    output: true
    permalink: /guides/:name/

defaults:
  - scope:
      path: ""
      type: guides
    values:
      layout: default
      show_toc: true

JSONPermalink to JSON

{
  "title": "Install",
  "published": true,
  "series": {
    "label": "First-site guide",
    "order": 10
  },
  "tags": ["docs", "setup"],
  "updated": null
}

Related documentation