mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-12 19:00:39 -07:00
* docs: polish theme, playground, and reference pages Improve readability of the docs site with updated light/dark tokens, shared code-block styling, and playground editors that follow system color scheme. Skip CookieHub on localhost, serve the browser bundle from theme source, and use backtick titles on filter/tag reference pages for consistent navigation. Co-authored-by: Cursor <[email protected]> * docs: highlight npx in bash blocks and polish English copy Use Prism insertBefore for CLI commands like npx, tighten tutorial and reference wording, and keep YAML titles free of backticks so sidebar and page headings stay correct. Co-authored-by: Cursor <[email protected]> * docs: restore lowercase filter and tag titles Titles should match actual filter/tag identifiers (e.g. abs, append), not capitalized English labels. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
'use strict'
|
|
|
|
/**
|
|
* Extend Prism's bash grammar with extra CLI commands for docs code blocks.
|
|
* Hexo loads scripts from docs/scripts/ during init, before `hexo generate`
|
|
* highlights fenced code via syntax_highlighter: prismjs.
|
|
*
|
|
* Bash highlights known commands via a large hard-coded regex (see prism-bash).
|
|
* insertBefore is the supported extension point when a command is not in that list.
|
|
* Add names to EXTRA_BASH_COMMANDS as needed.
|
|
*
|
|
* After editing this file, run `npx hexo clean` before generate/serve so
|
|
* Hexo re-highlights cached pages (db.json does not invalidate on script changes).
|
|
*/
|
|
const EXTRA_BASH_COMMANDS = [
|
|
'npx'
|
|
]
|
|
|
|
const Prism = require('prismjs')
|
|
require('prismjs/components/prism-bash')
|
|
|
|
const escaped = EXTRA_BASH_COMMANDS.map((cmd) =>
|
|
cmd.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
)
|
|
|
|
Prism.languages.insertBefore('bash', 'function', {
|
|
'cli-command': {
|
|
pattern: new RegExp(
|
|
`(^|[\\s;|&]|[<>]\\()(?:${escaped.join('|')})(?=$|[)\\s;|&])`
|
|
),
|
|
lookbehind: true,
|
|
alias: ['builtin', 'class-name']
|
|
}
|
|
})
|