diff --git a/.eleventy.js b/.eleventy.js deleted file mode 100644 index d2ac9e7..0000000 --- a/.eleventy.js +++ /dev/null @@ -1,34 +0,0 @@ -const { - Worker, - receiveMessageOnPort, - MessageChannel, -} = require("worker_threads"); - -// See https://giuseppegurgone.com/synchronizing-async-functions/ -function wait_highlight(...args) { - const worker = new Worker("./highlight_worker.js"); - const signal = new Int32Array(new SharedArrayBuffer(4)); - signal[0] = 0; - try { - const subChannel = new MessageChannel(); - worker.postMessage({ signal, port: subChannel.port1, args }, [ - subChannel.port1, - ]); - Atomics.wait(signal, 0, 0); - return receiveMessageOnPort(subChannel.port2).message.result; - } finally { - worker.unref(); - } -} - -module.exports = (eleventyConfig) => { - eleventyConfig.addPassthroughCopy("src/CNAME"); - eleventyConfig.addMarkdownHighlighter(wait_highlight); - - return { - dir: { - input: "src", - output: "docs", - }, - }; -}; diff --git a/.eleventy.mjs b/.eleventy.mjs new file mode 100644 index 0000000..a9dc6a6 --- /dev/null +++ b/.eleventy.mjs @@ -0,0 +1,32 @@ +import { createHighlighter } from "shiki"; +import path from "node:path"; +import { readFile } from "node:fs/promises"; + +export default function (eleventyConfig) { + eleventyConfig.addPassthroughCopy("src/CNAME"); + eleventyConfig.addMarkdownHighlighter(shikiHighlight); + + return { + dir: { + input: "src", + output: "docs", + }, + }; +}; + +const kdlGrammar = JSON.parse(await readFile(path.join(process.cwd(), "kdl.tmLanguage.json"), "utf8")); + +const highlighter = await createHighlighter({ + themes: ["nord"], + langs: [ + { + name: "kdl", + scopeName: "source.kdl", + ...kdlGrammar + }, + ], +}); + +function shikiHighlight(code, lang) { + return highlighter.codeToHtml(code, { lang, theme: "nord" }); +} \ No newline at end of file diff --git a/highlight_worker.js b/highlight_worker.js index 1be0d16..94770b8 100644 --- a/highlight_worker.js +++ b/highlight_worker.js @@ -13,7 +13,10 @@ async function shiki_highlight(code, lang) { }, ], }); - return highlighter.codeToHtml(code, lang); + console.log("highlighting..."); + const ret = highlighter.codeToHtml(code, lang); + console.log("highlighted!"); + return ret; } parentPort.addListener("message", async ({ signal, port, args }) => { @@ -21,8 +24,11 @@ parentPort.addListener("message", async ({ signal, port, args }) => { const result = await shiki_highlight(...args); // Post the result to the main thread before unlocking "signal" + console.log("posting result..."); port.postMessage({ result }); + console.log("posted result"); port.close(); + console.log("port closed"); // Change the value of signal[0] to 1 Atomics.store(signal, 0, 1); diff --git a/kdl.tmLanguage.json b/kdl.tmLanguage.json index 76b6233..137cbb5 100644 --- a/kdl.tmLanguage.json +++ b/kdl.tmLanguage.json @@ -1,14 +1,20 @@ { "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "comment": "Some of these patterns are taken straight from rust-analyzer: https://github.com/rust-lang/vscode-rust/blob/master/rust-analyzer/editors/code/rust.tmGrammar.json. Some was also taken from https://github.com/arm32x/vscode-sdlang/blob/master/syntaxes/sdlang.tmLanguage.json", - "name": "KDL", + "name": "kdl", "patterns": [ + { + "include": "#forbidden_ident" + }, { "include": "#null" }, { "include": "#boolean" }, + { + "include": "#float_keyword" + }, { "include": "#float_fraction" }, @@ -28,10 +34,13 @@ "include": "#binary" }, { - "include": "#raw-strings" + "include": "#raw-string" }, { - "include": "#strings" + "include": "#string_multi_line" + }, + { + "include": "#string_single_line" }, { "include": "#block_comment" @@ -45,6 +54,9 @@ { "include": "#slashdash_comment" }, + { + "include": "#slashdash_node_with_children_comment" + }, { "include": "#slashdash_node_comment" }, @@ -56,6 +68,9 @@ }, { "include": "#node_name" + }, + { + "include": "#ident_string" } ], "repository": { @@ -77,54 +92,77 @@ "hexadecimal": { "comment": "Integer literal (hexadecimal)", "name": "constant.numeric.integer.hexadecimal.rust", - "match": "\\b0x[a-fA-F0-9_]+\\b" + "match": "\\b0x[a-fA-F0-9][a-fA-F0-9_]*\\b" }, "octal": { "comment": "Integer literal (octal)", "name": "constant.numeric.integer.octal.rust", - "match": "\\b0o[0-7_]+\\b" + "match": "\\b0o[0-7][0-7_]*\\b" }, "binary": { "comment": "Integer literal (binary)", "name": "constant.numeric.integer.binary.rust", - "match": "\\b0b[01_]+\\b" + "match": "\\b0b[01][01_]*\\b" + }, + "forbidden_ident": { + "name": "invalid.illegal.kdl.bad-ident", + "match": "(?;\\[\\]\\=,])[\\w\\-_~!@#\\$%^&*+|/.\\(\\)]+" + "match": "((?<={|;)|^)\\s*(?![/\\\\{\\}#;\\[\\]\\=])[<>:\\w\\-_~,'`!\\?@\\$%^&*+|.\\(\\)]+\\d*[<>:\\w\\-_~,'`!\\?@\\$%^&*+|.\\(\\)]*" }, "attribute": { "name": "entity.other.attribute-name.kdl", - "match": "(?![\\\\{\\}<>;\\[\\]\\=,])[\\w\\-_~!@#\\$%^&*+|/.]+(=)", + "match": "(?![/\\\\{\\}#;\\[\\]\\=])[<>:\\w\\-_~,'`!\\?@\\$%^&*+|.\\(\\)]+\\d*[<>:\\w\\-_~,'`!\\?@\\$%^&*+|.\\(\\)]*(=)", "captures": { "1": { "name": "punctuation.separator.key-value.kdl" } } }, + "ident_string": { + "name": "string.unquoted", + "match": "(?![/\\\\{\\}#;\\[\\]\\=])[<>:\\w\\-_~,'`!\\?@\\$%^&*+|.\\(\\)]+\\d*[<>:\\w\\-_~,'`!\\?@\\$%^&*+|.\\(\\)]*" + }, + "float_keyword": { + "name": "constant.language.other.kdl", + "match": "#nan|#inf|#-inf" + }, "null": { "name": "constant.language.null.kdl", - "match": "\\bnull\\b" + "match": "#null" }, "boolean": { "name": "constant.language.boolean.kdl", - "match": "\\b(true|false)\\b" + "match": "#true|#false" }, - "strings": { + "string_single_line": { "name": "string.quoted.double.kdl", "begin": "\"", "end": "\"", "patterns": [ { "name": "constant.character.escape.kdl", - "match": "\\\\(:?[nrtbf\\\\\"]|u\\{[a-fA-F0-9]{1,6}\\})" + "match": "\\\\(:?[nrtbfs\\\\\"]|u\\{[a-fA-F0-9]{1,6}\\})" } ] }, - "raw-strings": { - "name": "string.quoted.double.raw.kdl", - "begin": "b?r(#*)\"", - "end": "\"\\1" + "string_multi_line": { + "name": "string.quoted.triple.kdl", + "begin": "\"\"\"", + "end": "\"\"\"", + "patterns": [ + { + "name": "constant.character.escape.kdl", + "match": "\\\\(:?[nrtbfs\\\\\"]|u\\{[a-fA-F0-9]{1,6}\\})" + } + ] + }, + "raw-string": { + "name": "string.quoted.other.raw.kdl", + "begin": "(#+)(\"{3,1})", + "end": "\\2\\1" }, "block_doc_comment": { "comment": "Block documentation comment", @@ -156,26 +194,32 @@ }, "line_comment": { "comment": "Single-line comment", - "name": "comment.line.double-slash.rust", + "name": "comment.line.double-slash.kdl", "begin": "//", "end": "$" }, "slashdash_comment": { - "name": "comment.line.double-slash", + "name": "comment.block.slashdash.kdl", "comment": "Slashdash inline comment", "begin": "(?=14" } }, + "node_modules/@shikijs/core": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.24.2.tgz", + "integrity": "sha512-BpbNUSKIwbKrRRA+BQj0BEWSw+8kOPKDJevWeSE/xIqGX7K0xrCZQ9kK0nnEQyrzsUoka1l81ZtJ2mGaCA32HQ==", + "dev": true, + "dependencies": { + "@shikijs/engine-javascript": "1.24.2", + "@shikijs/engine-oniguruma": "1.24.2", + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.3" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.24.2.tgz", + "integrity": "sha512-EqsmYBJdLEwEiO4H+oExz34a5GhhnVp+jH9Q/XjPjmBPc6TE/x4/gD0X3i0EbkKKNqXYHHJTJUpOLRQNkEzS9Q==", + "dev": true, + "dependencies": { + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0", + "oniguruma-to-es": "0.7.0" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.2.tgz", + "integrity": "sha512-ZN6k//aDNWRJs1uKB12pturKHh7GejKugowOFGAuG7TxDRLod1Bd5JhpOikOiFqPmKjKEPtEA6mRCf7q3ulDyQ==", + "dev": true, + "dependencies": { + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.2.tgz", + "integrity": "sha512-bdeWZiDtajGLG9BudI0AHet0b6e7FbR0EsE4jpGaI0YwHm/XJunI9+3uZnzFtX65gsyJ6ngCIWUfA4NWRPnBkQ==", + "dev": true, + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.1.tgz", + "integrity": "sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==", + "dev": true + }, "node_modules/@sindresorhus/slugify": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz", @@ -331,12 +382,42 @@ "tailwindcss": "2.0.0-alpha.24 || ^2.0.0" } }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/parse-json": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", "dev": true }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz", + "integrity": "sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==", + "dev": true + }, "node_modules/a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -731,6 +812,16 @@ } ] }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -747,6 +838,26 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chardet": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.0.0.tgz", @@ -887,6 +998,16 @@ "simple-swizzle": "^0.2.2" } }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/commander": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", @@ -1037,6 +1158,15 @@ "node": ">=4" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", @@ -1076,6 +1206,19 @@ "node": ">= 0.8.0" } }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -1202,6 +1345,12 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/emoji-regex-xs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex-xs/-/emoji-regex-xs-1.0.0.tgz", + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==", + "dev": true + }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -1753,6 +1902,42 @@ "node": ">= 0.4" } }, + "node_modules/hast-util-to-html": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.4.tgz", + "integrity": "sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==", + "dev": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dev": true, + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hex-color-regex": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", @@ -1783,6 +1968,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/htmlparser2": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", @@ -2070,18 +2265,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -2251,6 +2434,27 @@ "node": ">=0.10.0" } }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dev": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", @@ -2266,6 +2470,95 @@ "node": ">= 8" } }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-types": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.1.tgz", + "integrity": "sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -2515,22 +2808,15 @@ "wrappy": "1" } }, - "node_modules/onigasm": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", - "integrity": "sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==", + "node_modules/oniguruma-to-es": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.7.0.tgz", + "integrity": "sha512-HRaRh09cE0gRS3+wi2zxekB+I5L8C/gN60S+vb11eADHUaB/q4u8wGGOX3GvwvitG8ixaeycZfeoyruKQzUgNg==", "dev": true, "dependencies": { - "lru-cache": "^5.1.1" - } - }, - "node_modules/onigasm/node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" + "emoji-regex-xs": "^1.0.0", + "regex": "^5.0.2", + "regex-recursion": "^4.3.0" } }, "node_modules/package-json-from-dist": { @@ -2936,6 +3222,16 @@ "asap": "~2.0.3" } }, + "node_modules/property-information": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -3074,6 +3370,30 @@ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", "dev": true }, + "node_modules/regex": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/regex/-/regex-5.0.2.tgz", + "integrity": "sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==", + "dev": true, + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-4.3.0.tgz", + "integrity": "sha512-5LcLnizwjcQ2ALfOj95MjcatxyqF5RPySx9yT+PaXu3Gox2vyAtLDjHB8NTJLtMGkvyau6nI3CfpwFCjPUIs/A==", + "dev": true, + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", + "dev": true + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3296,34 +3616,17 @@ } }, "node_modules/shiki": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.2.7.tgz", - "integrity": "sha512-bwVc7cdtYYHEO9O+XJ8aNOskKRfaQd5Y4ovLRfbQkmiLSUaR+bdlssbZUUhbQ0JAFMYcTcJ5tjG5KtnufttDHQ==", + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.24.2.tgz", + "integrity": "sha512-TR1fi6mkRrzW+SKT5G6uKuc32Dj2EEa7Kj0k8kGqiBINb+C1TiflVOiT9ta6GqOJtC4fraxO5SLUaKBcSY38Fg==", "dev": true, "dependencies": { - "onigasm": "^2.2.5", - "shiki-languages": "^0.2.7", - "shiki-themes": "^0.2.7", - "vscode-textmate": "^5.2.0" - } - }, - "node_modules/shiki-languages": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/shiki-languages/-/shiki-languages-0.2.7.tgz", - "integrity": "sha512-REmakh7pn2jCn9GDMRSK36oDgqhh+rSvJPo77sdWTOmk44C5b0XlYPwJZcFOMJWUZJE0c7FCbKclw4FLwUKLRw==", - "dev": true, - "dependencies": { - "vscode-textmate": "^5.2.0" - } - }, - "node_modules/shiki-themes": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/shiki-themes/-/shiki-themes-0.2.7.tgz", - "integrity": "sha512-ZMmboDYw5+SEpugM8KGUq3tkZ0vXg+k60XX6NngDK7gc1Sv6YLUlanpvG3evm57uKJvfXsky/S5MzSOTtYKLjA==", - "dev": true, - "dependencies": { - "json5": "^2.1.0", - "vscode-textmate": "^5.2.0" + "@shikijs/core": "1.24.2", + "@shikijs/engine-javascript": "1.24.2", + "@shikijs/engine-oniguruma": "1.24.2", + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" } }, "node_modules/signal-exit": { @@ -3380,6 +3683,16 @@ "node": ">=0.10.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -3466,6 +3779,20 @@ "node": ">=8" } }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dev": true, + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", @@ -3649,12 +3976,90 @@ "node": ">=0.6" } }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dev": true }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", @@ -3715,11 +4120,33 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "node_modules/vscode-textmate": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.5.0.tgz", - "integrity": "sha512-jToQkPGMNKn0eyKyitYeINJF0NoD240aYyKPIWJv5W2jfPt++jIRg0OSergubtGhbw6SoefkvBYEpX7TsfoSUQ==", - "dev": true + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/which": { "version": "2.0.2", @@ -3869,12 +4296,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", @@ -3951,6 +4372,16 @@ "engines": { "node": ">=8" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/package.json b/package.json index 5714e8c..f5437a7 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "clean": "rm -rf docs && mkdir -p docs/styles", "static": "cp -r static/* docs", "build": "npm run clean && npm run static && postcss src/styles/global.css > docs/styles/global.css", - "dev": "npm run build && eleventy --serve", - "prod": "NODE_ENV=production npm run build && eleventy", + "dev": "npm run build && eleventy --config=.eleventy.mjs --serve", + "prod": "NODE_ENV=production npm run build && eleventy --config=.eleventy.mjs", "format": "prettier --write src ./*.js ./.*.js" }, "keywords": [], @@ -21,7 +21,7 @@ "postcss": "^8.2.1", "postcss-cli": "^8.3.1", "prettier": "^2.2.1", - "shiki": "^0.2.7", + "shiki": "^1.24.2", "tailwindcss": "^2.0.2" } } diff --git a/src/_includes/partials/compatibility-with-json-and-xml.md b/src/_includes/partials/compatibility-with-json-and-xml.md deleted file mode 100644 index d5aa81f..0000000 --- a/src/_includes/partials/compatibility-with-json-and-xml.md +++ /dev/null @@ -1,14 +0,0 @@ -
- -## Compatibility with JSON and XML - -There are two specifications for writing KDL that can be losslessly translated -between it and JSON or XML. These specifications define a stricter _subset_ of -KDL that, even if not entirely idiomatic, is still valid and fits into the -data models of the other two languages: - -* [JSON in KDL](https://github.com/kdl-org/kdl/blob/main/JSON-IN-KDL.md) -* [XML in KDL](https://github.com/kdl-org/kdl/blob/main/XML-IN-KDL.md) - -
- diff --git a/src/_includes/partials/description.md b/src/_includes/partials/description.md deleted file mode 100644 index 776c1bb..0000000 --- a/src/_includes/partials/description.md +++ /dev/null @@ -1,60 +0,0 @@ -
- -KDL is a small, pleasing document language with xml-like semantics that looks -like you're invoking a bunch of CLI commands! It's meant to be used both as a -serialization format and a configuration language, much like JSON, YAML, or -XML. It looks like this: - -```kdl -package { - name "my-pkg" - version "1.2.3" - - dependencies { - // Nodes can have standalone values as well as - // key/value pairs. - lodash "^3.2.1" optional=true alias="underscore" - } - - scripts { - // "Raw" and multi-line strings are supported. - build r#" - echo "foo" - node -c "console.log('hello, world!');" - echo "foo" > some-file.txt - "# - } - - // `\` breaks up a single node across multiple lines. - the-matrix 1 2 3 \ - 4 5 6 \ - 7 8 9 - - // "Slashdash" comments operate at the node level, - // with just `/-`. - /-this-is-commented { - this "entire" "node" { - "is" "gone" - } - } -} -``` - -There's a living [specification](https://github.com/kdl-org/kdl/blob/main/SPEC.md), as well as various -[implementations](#implementations). You can also check out the [FAQ](#faq) to -answer all your burning questions! - -In addition to a spec for KDL itself, there are also standard specs for [a KDL -Query Language](https://github.com/kdl-org/kdl/blob/main/QUERY-SPEC.md) based -on CSS selectors, and [a KDL Schema -Language](https://github.com/kdl-org/kdl/blob/main/SCHEMA-SPEC.md) loosely -based on JSON Schema. - -The language is based on [SDLang](https://sdlang.org), with a number of -modifications and clarifications on its syntax and behavior. - -The current version of the KDL spec is `1.0.0`. - -[Play with it in your browser!](https://kdl-play.danini.dev/) - -
diff --git a/src/_includes/partials/design-and-discussion.md b/src/_includes/partials/design-and-discussion.md deleted file mode 100644 index 516b083..0000000 --- a/src/_includes/partials/design-and-discussion.md +++ /dev/null @@ -1,9 +0,0 @@ -
- -## Design and Discussion - -KDL is still extremely new, and discussion about the format should happen over -on the [discussions](https://github.com/kdl-org/kdl/discussions) page in the -Github repo. Feel free to jump in and give us your 2 cents! - -
diff --git a/src/_includes/partials/design-principles.md b/src/_includes/partials/design-principles.md deleted file mode 100644 index 087b104..0000000 --- a/src/_includes/partials/design-principles.md +++ /dev/null @@ -1,11 +0,0 @@ -
- -## Design Principles - -1. Maintainability -1. Flexibility -1. Cognitive simplicity and Learnability -1. Ease of de/serialization -1. Ease of implementation - -
diff --git a/src/_includes/partials/faq.md b/src/_includes/partials/faq.md deleted file mode 100644 index c23db56..0000000 --- a/src/_includes/partials/faq.md +++ /dev/null @@ -1,103 +0,0 @@ -
- -## FAQ - -#### How do you pronounce KDL? - -Same as "cuddle". - -#### Why yet another document language? - -Because nothing out there felt quite right. The closest one I found was -SDLang, but that had some design choices I disagreed with. - -#### Ok, then, why not SDLang? - -SDLang is designed for use cases that are not interesting to me, but are very -relevant to the D-lang community. KDL is very similar in many ways, but is -different in the following ways: - -* The grammar and expected semantics are [well-defined and specified](https://github.com/kdl-org/kdl/blob/main/SPEC.md). -* There is only one "number" type. KDL does not prescribe representations. -* Slashdash (`/-`) comments are great and useful! -* I am not interested in having first-class date types, and SDLang's are very - non-standard. -* Values and properties can be interspersed with each other, rather than one - having to follow the other. -* KDL does not have a first-class binary data type. Just use strings with base64. -* All strings in KDL are multi-line, and raw strings are written with - Rust-style syntax (`r"foo"`), instead of backticks. -* KDL identifiers can use UTF-8 and are much more lax about symbols than SDLang. -* KDL does not support "anonymous" nodes. -* Instead, KDL supports arbitrary identifiers for node names and attribute - names, meaning you can use arbitrary strings for those: `"123" "value"=1` is - a valid node, for example. This makes it easier to use KDL for - representing arbitrary key/value pairs. - -#### Have you seen that one XKCD comic about standards? - -Yes. I have. Please stop linking me to it. - -#### What about YAML? - -YAML is a great, widespread language. Unlike KDL, which is node-based (like -XML or HTML), it's based on map and array data structures, which can provide -an easier serialization experience in some cases. - -At the same time, YAML can be ambiguous about what types the data written into -it is. There's also a persistent issue where very large YAML files become -unmanageable, especially due to the significant indentation feature. - -KDL is designed to avoid these particular pitfalls by always being explicit -about types, and having clearly-delimited scope (and the ability to -auto-indent/auto-format). Syntax errors are easier to catch, and large files -are (hopefully!) much more manageable. - -#### What about JSON? - -JSON is a great serialization language, but it can be very difficult to use as -a human configuration language. This is largely due to its very specific, very -strict syntax, as well as its lack of support for comments. - -KDL, on the other hand, has great comment support, and has a much more -forgiving syntax without being so flexible as to allow certain classes of -unfortunate mistakes. It also has much more flexibility around how to -represent data. - -If you need to interoperate with a service that consumes or emits JSON, or for -some other reason have need to write "JSON in KDL", [we have JiK, an official -microsyntax for losslessly encoding JSON](https://github.com/kdl-org/kdl/blob/main/JSON-IN-KDL.md). - -#### What about TOML? - -It nests very poorly. It doesn't fare well with large files. - -#### What about XML? - -XML is actually pretty fantastic, and has long been a standard for data -exchange across many industries. At the same time, XML is known to be very -verbose, and editing it involves writing (and updating) matching tags. Another -large pitfall with XML is its lack of direct support for arbitrary string -key/value pairs, so what would be a simple `foo: x` in some languages has to -be represented as `` or something similar. XML -also functions great as a **markup** language. That is, it is easy to -intersperse with text, like HTML. - -KDL, just like XML, is a node/element-based language, but with much more -lightweight syntax. It also adds the ability to apply anonymous values -directly to a node, rather than as children. That is, `nodename 1 2 3` instead -of `12(etc)`. This can make -it much more manageable and readable as a human configuration language, and is -also less verbose when exchanging documents across APIs! - -Finally, KDL is **not** a markup language. XML or HTML do a much better job of -"marking up" a text document with special tags, although KDL can still be -useful for templating engines that want to be more strict about text -fragments. - -If you need to interoperate with a service that consumes or emits XML, or for -some other reason have need to write "XML in KDL", [we have XiK, an official -microsyntax for losslessly encoding XML](https://github.com/kdl-org/kdl/blob/main/XML-IN-KDL.md). - - -
diff --git a/src/_includes/partials/implementations.md b/src/_includes/partials/implementations.md deleted file mode 100644 index 1998850..0000000 --- a/src/_includes/partials/implementations.md +++ /dev/null @@ -1,32 +0,0 @@ -
- -## Implementations - -* Rust: [kdl-rs](https://github.com/kdl-org/kdl-rs), [knuffel](https://crates.io/crates/knuffel/) (latter includes derive macro), and [kaydle](https://github.com/Lucretiel/kaydle) (serde-based) -* JavaScript: [kdljs](https://github.com/kdl-org/kdljs), [@virtualstate/kdl](https://github.com/virtualstate/kdl) (query only, JSX based) -* Ruby: [kdl-rb](https://github.com/danini-the-panini/kdl-rb) -* Dart: [kdl-dart](https://github.com/danini-the-panini/kdl-dart) -* Java: [kdl4j](https://github.com/hkolbeck/kdl4j) -* PHP: [kdl-php](https://github.com/kdl-org/kdl-php) -* Python: [kdl-py](https://github.com/tabatkins/kdlpy), [cuddle](https://github.com/djmattyg007/python-cuddle), [ckdl](https://github.com/tjol/ckdl) -* Elixir: [kuddle](https://github.com/IceDragon200/kuddle) -* XSLT: [xml2kdl](https://github.com/Devasta/XML2KDL) -* Haskell: [Hustle](https://github.com/fuzzypixelz/Hustle) -* .NET: [Kadlet](https://github.com/oledfish/Kadlet) -* C: [ckdl](https://github.com/tjol/ckdl) -* C++: [kdlpp](https://github.com/tjol/ckdl) (part of ckdl, requires C++20) -* OCaml: [ocaml-kdl](https://github.com/Bannerets/ocaml-kdl) -* Nim: [kdl-nim](https://github.com/Patitotective/kdl-nim) -* Common Lisp: [kdlcl](https://github.com/chee/kdlcl) -* Go: [gokdl](https://github.com/lunjon/gokdl), [kdl-go](https://github.com/sblinch/kdl-go) -* Swift: [kdl-swift](https://github.com/danini-the-panini/kdl-swift) -* Crystal: [kdl-cr](https://github.com/danini-the-panini/kdl-cr) -* Lua: [kdlua](https://github.com/danini-the-panini/kdlua) - -## Editor Support - -* [VS Code](https://marketplace.visualstudio.com/items?itemName=kdl-org.kdl&ssr=false#review-details) -* [Sublime Text](https://packagecontrol.io/packages/KDL) -* [Intellij IDEA](https://plugins.jetbrains.com/plugin/20136-kdl-document-language) -* [vim](https://github.com/imsnif/kdl.vim) -
diff --git a/src/_includes/partials/overview.md b/src/_includes/partials/overview.md deleted file mode 100644 index 266413b..0000000 --- a/src/_includes/partials/overview.md +++ /dev/null @@ -1,180 +0,0 @@ -
- -## Overview - -### Basics - -A KDL node is a node name, followed by zero or more "arguments", and -children. - -```kdl -title "Hello, World" -``` - -You can also have multiple values in a single node! - -```kdl -bookmarks 12 15 188 1234 -``` - -Nodes can have properties. - -```kdl -author "Alex Monad" email="alex@example.com" active=true -``` - -And they can have nested child nodes, too! - -```kdl -contents { - section "First section" { - paragraph "This is the first paragraph" - paragraph "This is the second paragraph" - } -} -``` - -Nodes without children are terminated by a newline, a semicolon, or the end of -a file stream: - -```kdl -node1; node2; node3; -``` - -### Values - -KDL supports 4 data types: - -* Strings: `"hello world"` -* Numbers: `123.45` -* Booleans: `true` and `false` -* Null: `null` - -#### Strings -It supports two different formats for string input: escaped and raw. - -```kdl -node "this\nhas\tescapes" -other r"C:\Users\zkat\" -``` -Both types of string can be multiline as-is, without a different syntax: - -```kdl -string "my -multiline -value" -``` - -And for raw strings, you can add any number of # after the r and the last " to -disambiguate literal " characters: - -```kdl -other-raw r#"hello"world"# -``` - -#### Numbers - -There's 4 ways to represent numbers in KDL. KDL does not prescribe any -representation for these numbers, and it's entirely up to individual -implementations whether to represent all numbers with a single type, or to -have different representations for different forms. - -KDL has regular decimal-radix numbers, with optional decimal part, as well as -an optional exponent. - -```kdl -num 1.234e-42 -``` - -And using the appropriate prefix, you can also enter hexadecimal, octal, and -binary literals: - -```kdl -my-hex 0xdeadbeef -my-octal 0o755 -my-binary 0b10101101 -``` - -Finally, all numbers can have underscores to help readability: - -```kdl -bignum 1_000_000 -``` - -### Comments - -KDL supports C-style comments, both line-based and multiline. Multiline -comments can be nested. - -```kdl -// C style - -/* -C style multiline -*/ - -tag /*foo=true*/ bar=false - -/*/* -hello -*/*/ -``` - -On top of that, KDL supports `/-` "slashdash" comments, which can be used to -comment out individual nodes, arguments, or children: - -```kdl -// This entire node and its children are all commented out. -/-mynode "foo" key=1 { - a - b - c -} - -mynode /-"commented" "not commented" /-key="value" /-{ - a - b -} -``` - -### Type Annotations - -KDL supports type annotations on both values and nodes. These can be -arbitrary, but can be used by individual implementations or use-cases to -constrain KDL's basic types. A number of type names are also reserved to have -specific meanings. - -```kdl -numbers (u8)10 (i32)20 myfloat=(f32)1.5 { - strings (uuid)"123e4567-e89b-12d3-a456-426614174000" (date)"2021-02-03" filter=(regex)r"$\d+" - (author)person name="Alex" -} -``` - -### More Details - -```kdl -// Nodes can be separated into multiple lines -title \ - "Some title" - - -// Files must be utf8 encoded! -smile "😁" - -// Instead of anonymous nodes, nodes and properties can be wrapped -// in "" for arbitrary node names. -"!@#$@$%Q#$%~@!40" "1.2.3" "!!!!!"=true - -// The following is a legal bare identifier: -foo123~!@#$%^&*.:'|?+ "weeee" - -// And you can also use unicode! -ノード お名前="☜(゚ヮ゚☜)" - -// kdl specifically allows properties and values to be -// interspersed with each other, much like CLI commands. -foo bar=true "baz" quux=false 1 2 3 -``` - -
diff --git a/src/index.md b/src/index.md index 8220348..ad55ebe 100644 --- a/src/index.md +++ b/src/index.md @@ -55,14 +55,15 @@ package { For more details, see the [overview below](#overview). -There's a living [specification](SPEC.md), as well as various -[implementations](#implementations). You can also check out the [FAQ](#faq) to -answer all your burning questions! +There's a living +[specification](https://github.com/kdl-org/kdl/blob/main/SPEC.md), as well as +various [implementations](#implementations). You can also check out the +[FAQ](#faq) to answer all your burning questions! The current version of the KDL spec is `2.0.0`. For legacy KDL, please refer to -the [KDL 1.0 spec](./SPEC_v1.md). All users are encouraged to migrate. -[Migration is forward-and-backward-compatible and -safe](./SPEC.md#compatibility), and can be automated. +the [KDL 1.0 spec](https://github.com/kdl-org/kdl/blob/main/SPEC_v1.md). All +users are encouraged to migrate. [Migration is forward-and-backward-compatible +and safe](./SPEC.md#compatibility), and can be automated. In addition to a spec for KDL itself, there are specifications for [a KDL Query Language](QUERY-SPEC.md) based on CSS selectors, and [a KDL Schema @@ -397,8 +398,8 @@ between it and JSON or XML. These specifications define a stricter _subset_ of KDL that, even if not entirely idiomatic, is still valid and fits into the data models of the other two languages: -* [JSON in KDL](JSON-IN-KDL.md) -* [XML in KDL](XML-IN-KDL.md) +* [JSON in KDL](https://github.com/kdl-org/kdl/blob/main/JSON-IN-KDL.md) +* [XML in KDL](https://github.com/kdl-org/kdl/blob/main/JSON-IN-KDL.md) @@ -485,7 +486,8 @@ represent data. If you need to interoperate with a service that consumes or emits JSON, or for some other reason have need to write "JSON in KDL", [we have JiK, an official -microsyntax for losslessly encoding JSON](JSON-IN-KDL.md). +microsyntax for losslessly encoding +JSON](https://github.com/kdl-org/kdl/blob/main/JSON-IN-KDL.md). #### What about TOML? @@ -516,6 +518,6 @@ fragments. If you need to interoperate with a service that consumes or emits XML, or for some other reason have need to write "XML in KDL", [we have XiK, an official -microsyntax for losslessly encoding XML](XML-IN-KDL.md). +microsyntax for losslessly encoding XML](https://github.com/kdl-org/kdl/blob/main/XML-IN-KDL.md). \ No newline at end of file