aboutsummaryrefslogtreecommitdiff
path: root/eleventy.config.js
blob: f187c9112f6bd217ebe606d752a047913151d6ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { InputPathToUrlTransformPlugin } from "@11ty/eleventy";
import pluginRss from "@11ty/eleventy-plugin-rss";
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import anchor from "markdown-it-anchor";

export default function (eleventyConfig) {
  eleventyConfig.addPlugin(InputPathToUrlTransformPlugin);
  eleventyConfig.addPlugin(syntaxHighlight, {
    errorOnInvalidLanguage: true,

    init({ Prism }) {
      // Conveniently, I only have to highlight a known and fairly small amount of syntax, so I can cheat.
      Prism.languages.crowbar = {
        number: /\d+/,
        keyword: /\b(char|function|int|float|void|const)\b/,
        function: /signal/,
        operator: /\*/,
        punctuation: /[()\[\];,]/,
      };
      Prism.languages.duckscript = {
        builtin: /if|else|end|eq|echo/,
        string: /"[^"]+"/,
        function: /print_fancy/,
        operator: /\$\{|}|\./,
      };
      Prism.languages.dyon = {
        keyword: /fn|if|else/,
        function: /handle_event|print_fancy/,
        builtin: /println|typeof|str/,
        string: /"[^"]+"/,
        operator: /==|\+/,
        punctuation: /[(){};]/,
      };
      Prism.languages.ketos = {
        builtin: /do|define|type-of|println/,
        function: /handle-event|print-fancy/,
        punctuation: /[()]/,
        string: /"[^"]+"/,
      };
      Prism.languages.peg = {
        string: /'[^']+'/,
        "class-name": /BasicType|Type|Expression/,
        operator: /[←\/*]/,
        punctuation: /[()]/,
      };
      Prism.languages.rhai = {
        keyword: /fn|if|else/,
        function: /handle_event|print_fancy/,
        builtin: /print|type_of/,
        string: /"[^"]+"/,
        operator: /==|\+/,
        punctuation: /[(){};]/,
      };
      Prism.languages.rune = {
        keyword: /fn|match|if|is/,
        function: /handle_event|print_fancy/,
        builtin: /println|int/,
        string: /"[^"]+"|`[^`]+`/,
        operator: /=>/,
        punctuation: /[(){},]/,
      };
      Prism.languages.text = {};
    },
  });
  eleventyConfig.addPlugin(pluginRss);

  eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(anchor));

  eleventyConfig.addPassthroughCopy("assets");
  eleventyConfig.ignores.add("README.md");
}