Syntax highlighting for code snippets

This commit is contained in:
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
```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 */ }
```

View File

@ -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": /[{}[\];(),.]/,

View File

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