Repository navigation
Use highlight.js v11 + npm highlightjs-move and fix mdbook warning - #14
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the mdBook site’s client-side syntax highlighting to Highlight.js v11, vendors a Move grammar via highlightjs-move, and adds a wrapper around mdbook-katex to suppress a known version-mismatch warning during builds. In addition, it significantly expands and reorganizes book content across multiple chapters (Tools, Error Handling, Closures, Concurrency, Stdlib, etc.).
Changes:
- Vendor Highlight.js v11 runtime + vendored
highlightjs-movegrammar and register/highlight Move blocks at runtime. - Add
mdbook-katexwrapper and bump mdBook pin versions across setup scripts/mise. - Add/expand multiple documentation chapters and update the book TOC accordingly (Tools/CLI/TS SDK, Error Handling, Closures, Concurrency, Stdlib, Events, Struct resources).
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| theme/highlight.js | Vendored Highlight.js v11 runtime for the book theme. |
| highlightjs-move.js | Vendored Move language definition and exposes window.hljsDefineMove. |
| move-init.js | Registers Move language and highlights Move code blocks on the page. |
| book.toml | Wires in katex wrapper command and adds Move/highlight JS to HTML output. |
| scripts/mdbook-katex-wrapper.sh | New wrapper to filter a specific mdbook-katex warning line. |
| scripts/setup.sh | Bumps mdbook install pin to 0.4.52. |
| scripts/setup.ps1 | Bumps mdbook install pin to 0.4.52 (Windows setup). |
| scripts/setup-mise.sh | Bumps mdbook install pin to 0.4.52 in mise setup flow. |
| mise.toml | Aligns mdbook version pin/task setup command to 0.4.52. |
| src/SUMMARY.md | Updates book structure/TOC for new/expanded sections. |
| src/tools/intro.md | Adds Tools section landing page. |
| src/tools/aptos-cli/intro.md | Expands Aptos CLI documentation intro and links. |
| src/tools/ts-sdk/intro.md | Adds TypeScript SDK overview/usage docs. |
| src/structs/resources.md | Adds expanded explanation/examples for resources via struct abilities. |
| src/standard_libraries/move_stdlib.md | Replaces TODO with Move stdlib overview and links. |
| src/standard_libraries/aptos_stdlib.md | Replaces TODO with Aptos stdlib overview and comparison table. |
| src/move/design_patterns/intro.md | Adds Move design patterns section intro content. |
| src/events/indexing.md | Replaces TODO with event indexing overview and examples. |
| src/concurrency/intro.md | Adds concurrency section introduction (Block-STM concepts). |
| src/concurrency/basics.md | Adds concurrency basics content and examples. |
| src/concurrency/types.md | Adds type-level concurrency discussion and examples. |
| src/common_programming_concepts/error_handling.md | Adds error handling chapter content and examples. |
| src/common_programming_concepts/recoverable_errors.md | Adds recoverable error patterns chapter content. |
| src/common_programming_concepts/unrecoverable_errors.md | Adds unrecoverable error handling chapter content. |
| src/closures/intro.md | Expands closures chapter introduction. |
| src/closures/defining.md | Adds detailed closures syntax/capture/usage documentation. |
| src/error_handling/intro.md | Removes old stub error-handling page (moved/replaced). |
| src/error_handling/recoverable_errors.md | Removes old stub page (moved/replaced). |
| src/error_handling/unrecoverable_errors.md | Removes old stub page (moved/replaced). |
| src/error_handling/when_to_use.md | Removes old stub page (moved/replaced). |
| WARP.md | Adds WARP.md file referencing CLAUDE.md. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ! mdbook-katex "$@" 2>"$err_file"; then | ||
| status=$? | ||
| fi |
There was a problem hiding this comment.
The wrapper never propagates mdbook-katex failures: inside if ! mdbook-katex ...; then status=$?; fi, $? is the status of the negated ! command (0), not the underlying mdbook-katex exit code. Capture the exit status without ! (or store it before negation) so the wrapper exits non-zero when mdbook-katex fails.
| if ! mdbook-katex "$@" 2>"$err_file"; then | |
| status=$? | |
| fi | |
| mdbook-katex "$@" 2>"$err_file" || status=$? |
| [preprocessor.katex] | ||
| command = "scripts/mdbook-katex-wrapper.sh" | ||
| after = ["links"] |
There was a problem hiding this comment.
preprocessor.katex.command points to a POSIX shell script. Since the repo includes a Windows setup script (scripts/setup.ps1), this will likely break mdBook builds on Windows unless users also have a compatible sh available. Consider switching the command back to mdbook-katex by default, or provide a cross-platform wrapper (e.g., a small Rust binary or a .ps1 wrapper plus a command that works on both platforms).
| const l=Object.create(null);function c(){if(!O.keywords)return void A.addText(S) | ||
| ;let e=0;O.keywordPatternRe.lastIndex=0;let n=O.keywordPatternRe.exec(S),t="" | ||
| ;for(;n;){t+=S.substring(e,n.index) | ||
| ;const i=v.case_insensitive?n[0].toLowerCase():n[0],r=(a=i,O.keywords[a]);if(r){ |
There was a problem hiding this comment.
Variable 'a' is used before its declaration.
| match:[/function/,/\s+/,t,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}], | ||
| className:{1:"keyword",3:"title.function"},label:"func.def",contains:[f], | ||
| illegal:/%/},v={ | ||
| match:n.concat(/\b/,(N=[...Ee,"super","import"].map((e=>e+"\\s*\\(")), |
There was a problem hiding this comment.
Variable 'N' is used before its declaration.
| literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", | ||
| built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" | ||
| },contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/, | ||
| starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)), |
There was a problem hiding this comment.
This assertion can never match.
| literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", | ||
| built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" | ||
| },contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/, | ||
| starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)), |
There was a problem hiding this comment.
This assertion can never match.
| begin:g("s|tr|y","\\[","\\]")},{begin:g("s|tr|y","\\{","\\}")}],relevance:2},{ | ||
| className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{ | ||
| begin:u("(?:m|qr)?",/\//,/\//)},{begin:u("m|qr",n.either(...d,{capture:!0 | ||
| }),/\1/)},{begin:u("m|qr",/\(/,/\)/)},{begin:u("m|qr",/\[/,/\]/)},{ |
There was a problem hiding this comment.
There is no capture group 1 in this regular expression.
a134eac to
4753240
Compare
Summary
theme/highlight.jshighlightjs-moveand register viamove-init.jsmdbook 0.4.52Validation
mdbook buildpasses