From 58f2021ad0789dfbb6009a980c6fda9fb788da5b Mon Sep 17 00:00:00 2001 From: Joshua Batty Date: Fri, 30 Sep 2022 14:23:06 +1000 Subject: [PATCH] Add some missing keywords for mdBook syntax highlighting (#2903) Add some missing keywords to the `sway.js` file. This was triggered by @Braqzen noticing some inconsistent highlighting in the generated MD books. Doesn't address custom types not being highlighted but that can be for a future PR. --- docs/theme/highlight.js | 4 ++-- scripts/highlightjs/sway.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/theme/highlight.js b/docs/theme/highlight.js index b4285d3ebe8..453f50c3bc0 100644 --- a/docs/theme/highlight.js +++ b/docs/theme/highlight.js @@ -303,8 +303,8 @@ anyNumberOfTimes:g};for(const e in A)"object"==typeof A[e]&&n(A[e]) grmr_sway:e=>{const t={className:"title.function.invoke",relevance:0, begin:b(/\b/,/(?!let\b)/,e.IDENT_RE,u(/\s*\(/))},n="([u](8|16|32|64))?";return{ name:"Sway",aliases:["sw"],keywords:{$pattern:e.IDENT_RE+"!?", -keyword:["abi","as","asm","const","contract","deref","enum","fn","if","impl","let","library","match","mut","else","predicate","ref","return","script","Self","self","storage","str","struct","trait","use","where","while"], -literal:["true","false"], +keyword:["abi","as","asm","break","const","continue","contract","dep","deref","else","enum","fn","for","if","impl","let","library","match","mut","predicate","pub","ref","return","script","Self","self","storage","str","struct","trait","use","where","while"], +literal:["true","false","Some","None","Ok","Err"], built_in:["bool","char","u8","u16","u32","u64","b256","str","Self"]}, illegal:"