diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
| commit | a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch) | |
| tree | 542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-keyman.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-keyman.js')
| -rw-r--r-- | public/prism/prism-keyman.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/public/prism/prism-keyman.js b/public/prism/prism-keyman.js new file mode 100644 index 0000000..cc58923 --- /dev/null +++ b/public/prism/prism-keyman.js @@ -0,0 +1,47 @@ +Prism.languages.keyman = { + comment: { + pattern: /\bc .*/i, + greedy: true, + }, + string: { + pattern: /"[^"\r\n]*"|'[^'\r\n]*'/, + greedy: true, + }, + 'virtual-key': { + pattern: + /\[\s*(?:(?:ALT|CAPS|CTRL|LALT|LCTRL|NCAPS|RALT|RCTRL|SHIFT)\s+)*(?:[TKU]_[\w?]+|[A-E]\d\d?|"[^"\r\n]*"|'[^'\r\n]*')\s*\]/i, + greedy: true, + alias: 'function', // alias for styles + }, + + // https://help.keyman.com/developer/language/guide/headers + 'header-keyword': { + pattern: /&\w+/, + alias: 'bold', // alias for styles + }, + 'header-statement': { + pattern: + /\b(?:bitmap|bitmaps|caps always off|caps on only|copyright|hotkey|language|layout|message|name|shift frees caps|version)\b/i, + alias: 'bold', // alias for styles + }, + + 'rule-keyword': { + pattern: + /\b(?:any|baselayout|beep|call|context|deadkey|dk|if|index|layer|notany|nul|outs|platform|reset|return|save|set|store|use)\b/i, + alias: 'keyword', + }, + 'structural-keyword': { + pattern: /\b(?:ansi|begin|group|match|nomatch|unicode|using keys)\b/i, + alias: 'keyword', + }, + + 'compile-target': { + pattern: /\$(?:keyman|keymanonly|keymanweb|kmfl|weaver):/i, + alias: 'property', + }, + + // U+####, x###, d### characters and numbers + number: /\b(?:U\+[\dA-F]+|d\d+|x[\da-f]+|\d+)\b/i, + operator: /[+>\\$]|\.\./, + punctuation: /[()=,]/, +}; |
