Syntax highlighting for code snippets

master
Araozu 2023-10-01 21:26:57 -05:00
parent cb5b87488a
commit b2d536d07f
3 changed files with 8 additions and 6 deletions

View File

@ -58,7 +58,7 @@ the right, we value the items on the left more.
## Improvements ## Improvements
```misti ```thp
use PDO use PDO
use Globals::Env use Globals::Env
@ -71,9 +71,8 @@ else {
die("All 3 db environment variables must be set.") die("All 3 db environment variables must be set.")
} }
match PDO(dbUri dbUser dbPassword) { match PDO(dbUri dbUser dbPassword)
Ok(connection) -> { /* db operations */ } | Ok(connection) { /* db operations */ }
Err(pdoException) -> { /* handle exception */ } | Err(pdoException) { /* handle exception */ }
}
``` ```

View File

@ -15,7 +15,7 @@ Prism.languages.thp = {
pattern: /(["])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, pattern: /(["])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true, 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, "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
"operator": /[<>]=?|[!=]=?=?|--?|\$|\+\+?|&&?|\|\|?|[?*/~^%]/, "operator": /[<>]=?|[!=]=?=?|--?|\$|\+\+?|&&?|\|\|?|[?*/~^%]/,
"punctuation": /[{}[\];(),.]/, "punctuation": /[{}[\];(),.]/,

View File

@ -58,5 +58,8 @@
{{markdown}} {{markdown}}
</main> </main>
</div> </div>
<script src="/js/prism.min.js"></script>
<script src="/js/prism.thp.js"></script>
</body> </body>
</html> </html>