mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-28 17:05:18 -05:00
docs: Add highlighting for devicetree and kconfig
Added syntax highlighting for devicetree and kconfig files. The PrismJS project is not accepting contributions right now as they work on a version 2 of the library, so the new language files are added directly here. Also enabled syntax highlighting for various languages that are used in the docs but aren't enabled in Docusaurus by default.
This commit is contained in:
committed by
Cem Aksoylar
parent
6af22424f1
commit
4a339093ce
44
docs/src/theme/prism/components/prism-kconfig.js
Normal file
44
docs/src/theme/prism/components/prism-kconfig.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
Prism.languages.kconfig = {
|
||||
comment: {
|
||||
pattern: /(^|[^\\])#.*/,
|
||||
lookbehind: true,
|
||||
greedy: true,
|
||||
},
|
||||
string: /"(?:\\.|[^\\\r\n"])*"/,
|
||||
helptext: {
|
||||
// help text ends at the first line at a lower level of indentation than the
|
||||
// first line of text.
|
||||
pattern: /(^\s*)(?:help|---help---)\s*^(\s+)(?:.+)(?:\s*^\2[^\n]*)*/m,
|
||||
lookbehind: true,
|
||||
alias: "string",
|
||||
inside: {
|
||||
keyword: /^(?:help|---help---)/,
|
||||
},
|
||||
},
|
||||
keyword:
|
||||
/\b(?:allnoconfig_y|bool|boolean|choice|comment|config|def_bool|def_hex|def_int|def_string|def_tristate|default|defconfig_list|depends|endchoice|endif|endmenu|env|hex|if|imply|int|mainmenu|menu|menuconfig|modules|on|option|optional|orsource|osource|prompt|range|rsource|select|source|string|tristate|visible)\b/,
|
||||
expansion: {
|
||||
pattern: /\$\([\s\S]+\)/,
|
||||
alias: "variable",
|
||||
inside: {
|
||||
function: /\$\(|\)/,
|
||||
punctuation: /,/,
|
||||
},
|
||||
},
|
||||
number: /\b(?:0[xX][0-9a-fA-F]+|\d+)/,
|
||||
boolean: {
|
||||
pattern: /\b(?:y|n|m)\b/,
|
||||
alias: "number",
|
||||
},
|
||||
variable: /\b[A-Z_]+\b/,
|
||||
operator: /[<>]=?|[!=]=?|&&|\|\|/,
|
||||
punctuation: /[()]/,
|
||||
};
|
||||
Reference in New Issue
Block a user