From b2d536d07fe36413e38405f04342d7c3ff982d58 Mon Sep 17 00:00:00 2001 From: Araozu Date: Sun, 1 Oct 2023 21:26:57 -0500 Subject: [PATCH] Syntax highlighting for code snippets --- md/learn/index.md | 9 ++++----- static/js/prism.thp.js | 2 +- static/template.html | 3 +++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/md/learn/index.md b/md/learn/index.md index a22181e..e9cbb5c 100644 --- a/md/learn/index.md +++ b/md/learn/index.md @@ -58,7 +58,7 @@ the right, we value the items on the left more. ## Improvements -```misti +```thp use PDO use Globals::Env @@ -71,9 +71,8 @@ else { die("All 3 db environment variables must be set.") } -match PDO(dbUri dbUser dbPassword) { - Ok(connection) -> { /* db operations */ } - Err(pdoException) -> { /* handle exception */ } -} +match PDO(dbUri dbUser dbPassword) +| Ok(connection) { /* db operations */ } +| Err(pdoException) { /* handle exception */ } ``` diff --git a/static/js/prism.thp.js b/static/js/prism.thp.js index 6d2c390..6122aa2 100644 --- a/static/js/prism.thp.js +++ b/static/js/prism.thp.js @@ -15,7 +15,7 @@ Prism.languages.thp = { pattern: /(["])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, greedy: true, }, - "keyword": /\b(?:break|catch|continue|do|else|elif|finally|for|fun|if|in|fn|nil|return|throw|try|while|val|var|type|match|with|of|abstract|class|interface|private|public|override|open)\b/, + "keyword": /\b(?:static|const|enum|loop|use|break|catch|continue|do|else|finally|for|fun|if|in|fn|nil|return|throw|try|while|val|var|type|match|with|of|abstract|class|interface|private|public|override|open)\b/, "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, "operator": /[<>]=?|[!=]=?=?|--?|\$|\+\+?|&&?|\|\|?|[?*/~^%]/, "punctuation": /[{}[\];(),.]/, diff --git a/static/template.html b/static/template.html index 6c845c0..6158f88 100644 --- a/static/template.html +++ b/static/template.html @@ -58,5 +58,8 @@ {{markdown}} + + + \ No newline at end of file