init: personal markdown knowledge base server
- Auto-discovers .md files from configurable content roots - On-the-fly markdown → HTML rendering (marked + highlight.js) - Directory tree navigation sidebar - Full-text search across all documents - Dark mode, responsive design, Ctrl+K quick search - Frontmatter (YAML) support via gray-matter - Configurable via config.json Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"title": "我的知识库",
|
||||
"port": 5173,
|
||||
"host": "0.0.0.0",
|
||||
"contentRoots": [
|
||||
{ "label": "DPDK → DPU 学习", "path": "../packet_forge/dpdk_study" }
|
||||
],
|
||||
"excludeDirs": ["node_modules", ".git", ".claude", "source", "assets", "build", "dist"],
|
||||
"excludeFiles": [".gitkeep", "package-lock.json"]
|
||||
}
|
||||
Generated
+960
@@ -0,0 +1,960 @@
|
||||
{
|
||||
"name": "kb-server",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "kb-server",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"express": "^4.21.0",
|
||||
"gray-matter": "^4.0.3",
|
||||
"highlight.js": "^11.10.0",
|
||||
"marked": "^14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmmirror.com/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.20.6",
|
||||
"resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.6.tgz",
|
||||
"integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"content-type": "~1.0.5",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "~1.2.0",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.4.24",
|
||||
"on-finished": "~2.4.1",
|
||||
"qs": "~6.15.1",
|
||||
"raw-body": "~2.5.3",
|
||||
"type-is": "~1.6.18",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
||||
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/destroy": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz",
|
||||
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
|
||||
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"license": "BSD-2-Clause",
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "4.22.2",
|
||||
"resolved": "https://registry.npmmirror.com/express/-/express-4.22.2.tgz",
|
||||
"integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.8",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "~1.20.5",
|
||||
"content-disposition": "~0.5.4",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "~0.7.1",
|
||||
"cookie-signature": "~1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "~1.3.1",
|
||||
"fresh": "~0.5.2",
|
||||
"http-errors": "~2.0.0",
|
||||
"merge-descriptors": "1.0.3",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "~2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"path-to-regexp": "~0.1.12",
|
||||
"proxy-addr": "~2.0.7",
|
||||
"qs": "~6.15.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"safe-buffer": "5.2.1",
|
||||
"send": "~0.19.0",
|
||||
"serve-static": "~1.16.2",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "~2.0.1",
|
||||
"type-is": "~1.6.18",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-extendable": "^0.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/finalhandler/-/finalhandler-1.3.2.tgz",
|
||||
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"statuses": "~2.0.2",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmmirror.com/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/gray-matter": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/gray-matter/-/gray-matter-4.0.3.tgz",
|
||||
"integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"js-yaml": "^3.13.1",
|
||||
"kind-of": "^6.0.2",
|
||||
"section-matter": "^1.0.0",
|
||||
"strip-bom-string": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.4.tgz",
|
||||
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/highlight.js": {
|
||||
"version": "11.11.1",
|
||||
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.11.1.tgz",
|
||||
"integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.1.tgz",
|
||||
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"depd": "~2.0.0",
|
||||
"inherits": "~2.0.4",
|
||||
"setprototypeof": "~1.2.0",
|
||||
"statuses": "~2.0.2",
|
||||
"toidentifier": "~1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/is-extendable": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/is-extendable/-/is-extendable-0.1.1.tgz",
|
||||
"integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "3.15.1",
|
||||
"resolved": "https://registry.npmmirror.com/js-yaml/-/js-yaml-3.15.1.tgz",
|
||||
"integrity": "sha512-S99WuO3HlhO3XN41EtYUNl9zzXjoJx7QvmipxsJVxtCBT0YHEFy+iOJhjSvrmV12nYhWpZaM8lPHkJm0yUMbag==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/kind-of": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/kind-of/-/kind-of-6.0.3.tgz",
|
||||
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/marked": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmmirror.com/marked/-/marked-14.1.4.tgz",
|
||||
"integrity": "sha512-vkVZ8ONmUdPnjCKc5uTRvmkRbx4EAi2OkTOXmfTDhZz3OFqMNBM1oTTWwTr4HY4uAEojhzPf+Fy8F1DWa3Sndg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"marked": "bin/marked.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
||||
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
||||
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.15.3",
|
||||
"resolved": "https://registry.npmmirror.com/qs/-/qs-6.15.3.tgz",
|
||||
"integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.1",
|
||||
"side-channel": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.3.tgz",
|
||||
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.4.24",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/section-matter": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/section-matter/-/section-matter-1.0.0.tgz",
|
||||
"integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"extend-shallow": "^2.0.1",
|
||||
"kind-of": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmmirror.com/send/-/send-0.19.2.tgz",
|
||||
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "~0.5.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.3",
|
||||
"on-finished": "~2.4.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "~2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/send/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "1.16.3",
|
||||
"resolved": "https://registry.npmmirror.com/serve-static/-/serve-static-1.16.3.tgz",
|
||||
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "~0.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.1.tgz",
|
||||
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4",
|
||||
"side-channel-list": "^1.0.1",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-bom-string": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/strip-bom-string/-/strip-bom-string-1.0.0.tgz",
|
||||
"integrity": "sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "kb-server",
|
||||
"version": "1.0.0",
|
||||
"description": "Personal Markdown Knowledge Base — universal .md file renderer and blog",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.21.0",
|
||||
"marked": "^14.0.0",
|
||||
"highlight.js": "^11.10.0",
|
||||
"gray-matter": "^4.0.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>我的知识库</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #ffffff; --bg2: #f8f9fa; --text: #1a1a2e; --text2: #555;
|
||||
--border: #e5e7eb; --brand: #2563eb; --brand-light: #eff6ff;
|
||||
--code-bg: #f1f5f9; --shadow: 0 1px 3px rgba(0,0,0,.08);
|
||||
--sidebar-w: 280px;
|
||||
}
|
||||
.dark { --bg: #0f172a; --bg2: #1e293b; --text: #e2e8f0; --text2: #94a3b8;
|
||||
--border: #334155; --brand: #60a5fa; --brand-light: #1e3a5f;
|
||||
--code-bg: #1e293b; --shadow: 0 1px 3px rgba(0,0,0,.3); }
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
body { font: 15px/1.7 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans SC",sans-serif;
|
||||
background:var(--bg); color:var(--text); display:flex; height:100vh; overflow:hidden; }
|
||||
|
||||
/* Sidebar */
|
||||
#sidebar { width:var(--sidebar-w); min-width:var(--sidebar-w); background:var(--bg2);
|
||||
border-right:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; }
|
||||
#sb-header { padding:16px; border-bottom:1px solid var(--border); }
|
||||
#sb-header h2 { font-size:17px; font-weight:700; color:var(--brand); white-space:nowrap; }
|
||||
#sb-search { width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:6px;
|
||||
background:var(--bg); color:var(--text); font-size:13px; margin-top:8px; outline:none; }
|
||||
#sb-search:focus { border-color:var(--brand); box-shadow:0 0 0 2px rgba(37,99,235,.15); }
|
||||
#sb-tree { flex:1; overflow-y:auto; padding:8px 0; }
|
||||
.tree-node { user-select:none; }
|
||||
.tree-dir { display:flex; align-items:center; padding:4px 12px; cursor:pointer;
|
||||
font-size:13px; font-weight:600; color:var(--text2); gap:4px; }
|
||||
.tree-dir:hover { background:var(--brand-light); color:var(--brand); }
|
||||
.tree-dir .arrow { font-size:10px; transition:transform .2s; width:14px; text-align:center; }
|
||||
.tree-dir.open .arrow { transform:rotate(90deg); }
|
||||
.tree-children { display:none; padding-left:12px; }
|
||||
.tree-children.open { display:block; }
|
||||
.tree-file { display:flex; align-items:center; padding:3px 12px 3px 24px;
|
||||
cursor:pointer; font-size:13px; color:var(--text); text-decoration:none;
|
||||
border-left:2px solid transparent; transition:all .15s; }
|
||||
.tree-file:hover { background:var(--brand-light); color:var(--brand); }
|
||||
.tree-file.active { border-left-color:var(--brand); background:var(--brand-light);
|
||||
color:var(--brand); font-weight:600; }
|
||||
.tree-file .file-icon { margin-right:6px; opacity:.5; font-size:11px; }
|
||||
|
||||
/* Search overlay */
|
||||
#search-overlay { display:none; position:fixed; top:0;left:0;right:0;bottom:0;
|
||||
background:rgba(0,0,0,.3); z-index:100; align-items:flex-start; justify-content:center;
|
||||
padding-top:60px; }
|
||||
#search-overlay.show { display:flex; }
|
||||
#search-box { width:600px; max-width:90vw; background:var(--bg); border-radius:10px;
|
||||
box-shadow:0 8px 30px rgba(0,0,0,.2); overflow:hidden; }
|
||||
#search-input { width:100%; padding:14px 18px; font-size:16px; border:none;
|
||||
background:var(--bg); color:var(--text); outline:none; border-bottom:1px solid var(--border); }
|
||||
#search-results { max-height:60vh; overflow-y:auto; }
|
||||
.search-item { padding:10px 18px; cursor:pointer; border-bottom:1px solid var(--border); }
|
||||
.search-item:hover { background:var(--brand-light); }
|
||||
.search-item .s-name { font-weight:600; color:var(--brand); font-size:14px; }
|
||||
.search-item .s-dir { font-size:11px; color:var(--text2); }
|
||||
.search-item .s-snippet { font-size:12px; color:var(--text2); margin-top:2px;
|
||||
white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
|
||||
/* Main content */
|
||||
#main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
|
||||
#topbar { display:flex; align-items:center; justify-content:space-between;
|
||||
padding:10px 20px; border-bottom:1px solid var(--border); background:var(--bg);
|
||||
gap:12px; }
|
||||
#topbar .tabs { display:flex; gap:4px; flex:1; overflow-x:auto; }
|
||||
#topbar .tab { padding:6px 14px; border-radius:6px; font-size:13px; cursor:pointer;
|
||||
white-space:nowrap; color:var(--text2); border:1px solid transparent; }
|
||||
#topbar .tab:hover { background:var(--bg2); }
|
||||
#topbar .tab.active { background:var(--brand); color:#fff; }
|
||||
#top-actions { display:flex; gap:8px; align-items:center; }
|
||||
#top-actions button { background:var(--bg2); border:1px solid var(--border); border-radius:6px;
|
||||
padding:6px 10px; cursor:pointer; font-size:18px; line-height:1; color:var(--text); }
|
||||
#top-actions button:hover { background:var(--brand-light); }
|
||||
#content { flex:1; overflow-y:auto; padding:24px 32px; max-width:900px; }
|
||||
#content h1 { font-size:2rem; margin-bottom:.3em; letter-spacing:-.02em; }
|
||||
#content h2 { font-size:1.4rem; margin:1.8em 0 .5em; padding-bottom:.3em;
|
||||
border-bottom:1px solid var(--border); }
|
||||
#content h3 { font-size:1.15rem; margin:1.2em 0 .3em; }
|
||||
#content p { margin:.6em 0; }
|
||||
#content a { color:var(--brand); text-decoration:none; }
|
||||
#content a:hover { text-decoration:underline; }
|
||||
#content code { font-family:"JetBrains Mono","Fira Code","Cascadia Code",monospace;
|
||||
font-size:.88em; background:var(--code-bg); padding:1px 5px; border-radius:3px; }
|
||||
#content pre { background:var(--code-bg); border-radius:8px; padding:14px 18px;
|
||||
overflow-x:auto; margin:1em 0; border:1px solid var(--border); }
|
||||
#content pre code { background:none; padding:0; font-size:.85em; line-height:1.6; }
|
||||
#content table { width:100%; border-collapse:collapse; margin:1em 0; font-size:.93em; }
|
||||
#content th { background:var(--bg2); font-weight:600; padding:8px 12px;
|
||||
border:1px solid var(--border); text-align:left; }
|
||||
#content td { padding:6px 12px; border:1px solid var(--border); }
|
||||
#content blockquote { border-left:3px solid var(--brand); margin:.8em 0;
|
||||
padding:6px 16px; background:var(--brand-light); border-radius:0 6px 6px 0; }
|
||||
#content img { max-width:100%; border-radius:6px; }
|
||||
#content ul, #content ol { padding-left:1.5em; margin:.5em 0; }
|
||||
#content li { margin:.2em 0; }
|
||||
#content input[type="checkbox"] { margin-right:.4em; }
|
||||
/* Frontmatter display */
|
||||
.frontmatter { background:var(--bg2); border:1px solid var(--border); border-radius:8px;
|
||||
padding:12px 16px; margin-bottom:20px; font-size:13px; }
|
||||
.frontmatter table { margin:0; }
|
||||
.frontmatter td:first-child { font-weight:600; white-space:nowrap; padding-right:16px; }
|
||||
|
||||
/* Welcome */
|
||||
#welcome { display:flex; flex-direction:column; align-items:center;
|
||||
justify-content:center; height:100%; text-align:center; padding:40px; }
|
||||
#welcome h1 { font-size:2.5rem; background:linear-gradient(135deg,#2563eb,#06b6d4);
|
||||
-webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
|
||||
#welcome p { color:var(--text2); font-size:1.1rem; max-width:500px; margin:12px 0; }
|
||||
#welcome .stats { display:flex; gap:24px; margin-top:24px; }
|
||||
#welcome .stat { text-align:center; }
|
||||
#welcome .stat .num { font-size:2rem; font-weight:700; color:var(--brand); }
|
||||
#welcome .stat .label { font-size:.85rem; color:var(--text2); }
|
||||
|
||||
/* Mobile */
|
||||
@media (max-width:768px) {
|
||||
#sidebar { display:none; }
|
||||
#content { padding:16px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="sidebar">
|
||||
<div id="sb-header">
|
||||
<h2>📚 我的知识库</h2>
|
||||
<input id="sb-search" type="text" placeholder="搜索..." onfocus="openSearch()" autocomplete="off">
|
||||
</div>
|
||||
<div id="sb-tree"></div>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<div id="topbar">
|
||||
<div class="tabs" id="tabs"></div>
|
||||
<div id="top-actions">
|
||||
<button title="搜索 (Ctrl+K)" onclick="openSearch()">🔍</button>
|
||||
<button title="切换主题" onclick="toggleDark()" id="dark-btn">🌙</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content"><div id="welcome">
|
||||
<h1>📚 我的知识库</h1>
|
||||
<p>DPDK 学习笔记 · uNOS 设计 · 家庭网关产品 · 开发日志</p>
|
||||
<div class="stats">
|
||||
<div class="stat"><div class="num" id="stat-files">...</div><div class="label">Markdown 文档</div></div>
|
||||
<div class="stat"><div class="num" id="stat-dirs">...</div><div class="label">目录</div></div>
|
||||
</div>
|
||||
<p style="margin-top:20px;font-size:.9em;opacity:.6">
|
||||
Ctrl+K 全局搜索 · 点击左侧目录浏览 · 所有 .md 文件自动发现
|
||||
</p>
|
||||
</div></div>
|
||||
</div>
|
||||
|
||||
<div id="search-overlay" onclick="if(event.target===this)closeSearch()">
|
||||
<div id="search-box">
|
||||
<input id="search-input" type="text" placeholder="搜索所有 Markdown 文档..." autofocus
|
||||
oninput="doSearch(this.value)" onkeydown="if(event.key==='Escape')closeSearch()">
|
||||
<div id="search-results"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const API = '/api';
|
||||
let treeData = {};
|
||||
let activeFile = null;
|
||||
let activeRoot = null;
|
||||
let tabHistory = [];
|
||||
|
||||
// Init
|
||||
(async function init() {
|
||||
if (localStorage.getItem('kb-dark') === '1') document.body.classList.add('dark');
|
||||
updateDarkBtn();
|
||||
try {
|
||||
const r = await fetch(`${API}/tree`);
|
||||
treeData = await r.json();
|
||||
const roots = Object.keys(treeData);
|
||||
renderTabs(roots);
|
||||
renderTree(treeData);
|
||||
if (roots.length > 0) selectRoot(roots[0]);
|
||||
updateStats();
|
||||
} catch(e) { console.error(e); }
|
||||
document.addEventListener('keydown', e => {
|
||||
if ((e.ctrlKey||e.metaKey) && e.key==='k') { e.preventDefault(); openSearch(); }
|
||||
});
|
||||
})();
|
||||
|
||||
function updateStats() {
|
||||
let files = 0, dirs = new Set();
|
||||
for (const [root, nodes] of Object.entries(treeData)) {
|
||||
walkNodes(nodes, n => {
|
||||
if (n.type === 'file') { files++; dirs.add(n.dir); }
|
||||
});
|
||||
}
|
||||
document.getElementById('stat-files').textContent = files;
|
||||
document.getElementById('stat-dirs').textContent = dirs.size;
|
||||
}
|
||||
|
||||
function walkNodes(nodes, fn) {
|
||||
for (const n of nodes) {
|
||||
fn(n);
|
||||
if (n.children) walkNodes(n.children, fn);
|
||||
}
|
||||
}
|
||||
|
||||
function renderTabs(roots) {
|
||||
const tabs = document.getElementById('tabs');
|
||||
tabs.innerHTML = roots.map(r => `<span class="tab" data-root="${r}" onclick="selectRoot('${r}')">${r}</span>`).join('');
|
||||
}
|
||||
|
||||
function selectRoot(label) {
|
||||
activeRoot = label;
|
||||
document.querySelectorAll('.tab').forEach(t => t.classList.toggle('active', t.dataset.root === label));
|
||||
renderTree(treeData);
|
||||
loadContent(null);
|
||||
document.getElementById('content').innerHTML = document.getElementById('welcome').outerHTML;
|
||||
updateStats();
|
||||
}
|
||||
|
||||
function renderTree(data) {
|
||||
const tree = document.getElementById('sb-tree');
|
||||
if (!activeRoot || !data[activeRoot]) { tree.innerHTML = ''; return; }
|
||||
tree.innerHTML = renderNodes(data[activeRoot]);
|
||||
// Re-bind events
|
||||
tree.querySelectorAll('.tree-dir').forEach(el => {
|
||||
el.onclick = function() {
|
||||
this.classList.toggle('open');
|
||||
this.nextElementSibling?.classList.toggle('open');
|
||||
};
|
||||
// Open first level by default
|
||||
el.classList.add('open');
|
||||
if (el.nextElementSibling) el.nextElementSibling.classList.add('open');
|
||||
});
|
||||
tree.querySelectorAll('.tree-file').forEach(el => {
|
||||
el.onclick = function() { loadContent({label:activeRoot,relative:this.dataset.rel}); };
|
||||
});
|
||||
}
|
||||
|
||||
function renderNodes(nodes) {
|
||||
return nodes.map(n => {
|
||||
if (n.type === 'dir') {
|
||||
const label = n.name.replace(/^(\d+-)/,'').replace(/-/g,' ');
|
||||
return `<div class="tree-node">
|
||||
<div class="tree-dir"><span class="arrow">▶</span> ${label}</div>
|
||||
<div class="tree-children">${renderNodes(n.children||[])}</div>
|
||||
</div>`;
|
||||
} else {
|
||||
const icon = '📄';
|
||||
return `<div class="tree-file" data-rel="${n.relative}" title="${n.relative}">
|
||||
<span class="file-icon">${icon}</span>${n.name.replace(/-/g,' ')}
|
||||
</div>`;
|
||||
}
|
||||
}).join('');
|
||||
}
|
||||
|
||||
async function loadContent(file) {
|
||||
if (!file) {
|
||||
document.getElementById('content').innerHTML = document.getElementById('welcome').outerHTML;
|
||||
updateStats();
|
||||
return;
|
||||
}
|
||||
document.querySelectorAll('.tree-file').forEach(f => f.classList.remove('active'));
|
||||
document.querySelector(`.tree-file[data-rel="${file.relative}"]`)?.classList.add('active');
|
||||
activeFile = file;
|
||||
try {
|
||||
const r = await fetch(`${API}/file?label=${encodeURIComponent(file.label)}&rel=${encodeURIComponent(file.relative)}`);
|
||||
if (!r.ok) throw new Error('not found');
|
||||
const data = await r.json();
|
||||
let html = `<h1>${data.name.replace(/-/g,' ')}</h1>`;
|
||||
if (data.frontmatter && Object.keys(data.frontmatter).length > 0) {
|
||||
html += '<div class="frontmatter"><table>';
|
||||
for (const [k,v] of Object.entries(data.frontmatter)) {
|
||||
html += `<tr><td>${k}</td><td>${v}</td></tr>`;
|
||||
}
|
||||
html += '</table></div>';
|
||||
}
|
||||
html += data.html;
|
||||
document.getElementById('content').innerHTML = html;
|
||||
} catch(e) {
|
||||
document.getElementById('content').innerHTML = `<h1>加载失败</h1><p>${e.message}</p>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Search
|
||||
function openSearch() {
|
||||
document.getElementById('search-overlay').classList.add('show');
|
||||
document.getElementById('search-input').value = '';
|
||||
document.getElementById('search-results').innerHTML = '';
|
||||
setTimeout(() => document.getElementById('search-input').focus(), 100);
|
||||
}
|
||||
function closeSearch() { document.getElementById('search-overlay').classList.remove('show'); }
|
||||
async function doSearch(q) {
|
||||
const results = document.getElementById('search-results');
|
||||
if (q.length < 2) { results.innerHTML = ''; return; }
|
||||
try {
|
||||
const r = await fetch(`${API}/search?q=${encodeURIComponent(q)}`);
|
||||
const data = await r.json();
|
||||
results.innerHTML = data.map(f => `
|
||||
<div class="search-item" onclick="loadContent({label:'${f.label}',relative:'${f.relative}'});closeSearch();selectRoot('${f.label}')">
|
||||
<div class="s-name">📄 ${f.name.replace(/-/g,' ')}</div>
|
||||
<div class="s-dir">${f.label} / ${f.dir}</div>
|
||||
<div class="s-snippet">${f.snippet}</div>
|
||||
</div>`).join('');
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function toggleDark() {
|
||||
document.body.classList.toggle('dark');
|
||||
localStorage.setItem('kb-dark', document.body.classList.contains('dark') ? '1' : '0');
|
||||
updateDarkBtn();
|
||||
}
|
||||
function updateDarkBtn() {
|
||||
document.getElementById('dark-btn').textContent = document.body.classList.contains('dark') ? '☀️' : '🌙';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,190 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { marked } = require('marked');
|
||||
const hljs = require('highlight.js');
|
||||
const matter = require('gray-matter');
|
||||
|
||||
const app = express();
|
||||
const CONFIG = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'), 'utf-8'));
|
||||
|
||||
// Configure marked with highlight.js
|
||||
marked.setOptions({
|
||||
highlight: (code, lang) => {
|
||||
if (lang && hljs.getLanguage(lang)) {
|
||||
return hljs.highlight(code, { language: lang }).value;
|
||||
}
|
||||
return hljs.highlightAuto(code).value;
|
||||
},
|
||||
breaks: true,
|
||||
gfm: true,
|
||||
});
|
||||
|
||||
// Resolve content roots to absolute paths
|
||||
const contentRoots = CONFIG.contentRoots.map(r => ({
|
||||
label: r.label,
|
||||
path: path.resolve(__dirname, r.path),
|
||||
})).filter(r => fs.existsSync(r.path));
|
||||
|
||||
const excludeDirs = new Set(CONFIG.excludeDirs || []);
|
||||
const excludeFiles = new Set(CONFIG.excludeFiles || []);
|
||||
|
||||
// Recursively scan directory for .md files
|
||||
function scanDir(dir, basePath, label, results = []) {
|
||||
if (!fs.existsSync(dir)) return results;
|
||||
try {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const e of entries) {
|
||||
const full = path.join(dir, e.name);
|
||||
const rel = path.relative(basePath, full);
|
||||
if (e.isDirectory()) {
|
||||
if (!excludeDirs.has(e.name) && !e.name.startsWith('.')) {
|
||||
scanDir(full, basePath, label, results);
|
||||
}
|
||||
} else if (e.isFile() && e.name.endsWith('.md') && !excludeFiles.has(e.name)) {
|
||||
results.push({
|
||||
label,
|
||||
relative: rel.replace(/\\/g, '/'),
|
||||
name: e.name.replace(/\.md$/, ''),
|
||||
dir: path.dirname(rel).replace(/\\/g, '/'),
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (_) { /* skip permission errors */ }
|
||||
return results;
|
||||
}
|
||||
|
||||
// Build file tree
|
||||
function buildTree(files) {
|
||||
const tree = {};
|
||||
for (const f of files) {
|
||||
const parts = f.relative.split('/');
|
||||
let node = tree;
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const isFile = i === parts.length - 1;
|
||||
if (isFile) {
|
||||
if (!node._files) node._files = [];
|
||||
node._files.push(f);
|
||||
} else {
|
||||
if (!node[parts[i]]) node[parts[i]] = {};
|
||||
node = node[parts[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
// Convert tree to sortable array for JSON
|
||||
function treeToJSON(tree, depth = 0) {
|
||||
const result = [];
|
||||
const dirs = Object.keys(tree).filter(k => k !== '_files').sort((a, b) => {
|
||||
// Special ordering: numeric prefixes first, then alpha
|
||||
const an = a.replace(/^\d+-/, '');
|
||||
const bn = b.replace(/^\d+-/, '');
|
||||
return an.localeCompare(bn, 'zh-CN');
|
||||
});
|
||||
for (const dir of dirs) {
|
||||
const children = treeToJSON(tree[dir], depth + 1);
|
||||
if (children.length > 0 || (tree[dir]._files && tree[dir]._files.length > 0)) {
|
||||
result.push({ type: 'dir', name: dir, children });
|
||||
}
|
||||
}
|
||||
if (tree._files) {
|
||||
const files = tree._files.sort((a, b) => a.name.localeCompare(b.name, 'zh-CN'));
|
||||
for (const f of files) {
|
||||
result.push({
|
||||
type: 'file',
|
||||
name: f.name,
|
||||
label: f.label,
|
||||
relative: f.relative,
|
||||
dir: f.dir,
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// API: get file tree
|
||||
app.get('/api/tree', (req, res) => {
|
||||
let allFiles = [];
|
||||
for (const root of contentRoots) {
|
||||
allFiles = allFiles.concat(scanDir(root.path, root.path, root.label));
|
||||
}
|
||||
// Build merged tree grouped by content root
|
||||
const byRoot = {};
|
||||
for (const f of allFiles) {
|
||||
if (!byRoot[f.label]) byRoot[f.label] = [];
|
||||
byRoot[f.label].push(f);
|
||||
}
|
||||
const result = {};
|
||||
for (const [label, files] of Object.entries(byRoot)) {
|
||||
result[label] = treeToJSON(buildTree(files));
|
||||
}
|
||||
res.json(result);
|
||||
});
|
||||
|
||||
// API: get file content
|
||||
app.get('/api/file', (req, res) => {
|
||||
const { label, rel } = req.query;
|
||||
if (!rel) return res.status(400).json({ error: 'missing rel' });
|
||||
const root = contentRoots.find(r => r.label === label);
|
||||
if (!root) return res.status(400).json({ error: 'unknown label' });
|
||||
const full = path.resolve(root.path, rel);
|
||||
// Security: ensure path stays within root
|
||||
if (!full.startsWith(root.path)) return res.status(403).json({ error: 'forbidden' });
|
||||
if (!fs.existsSync(full)) return res.status(404).json({ error: 'not found' });
|
||||
try {
|
||||
const raw = fs.readFileSync(full, 'utf-8');
|
||||
const { data, content } = matter(raw);
|
||||
const html = marked.parse(content);
|
||||
res.json({
|
||||
name: path.basename(rel, '.md'),
|
||||
frontmatter: data,
|
||||
html,
|
||||
raw: content,
|
||||
});
|
||||
} catch (e) {
|
||||
res.status(500).json({ error: e.message });
|
||||
}
|
||||
});
|
||||
|
||||
// API: full-text search
|
||||
app.get('/api/search', (req, res) => {
|
||||
const q = (req.query.q || '').toLowerCase();
|
||||
if (q.length < 2) return res.json([]);
|
||||
let allFiles = [];
|
||||
for (const root of contentRoots) {
|
||||
allFiles = allFiles.concat(scanDir(root.path, root.path, root.label));
|
||||
}
|
||||
const results = [];
|
||||
for (const f of allFiles) {
|
||||
const root = contentRoots.find(r => r.label === f.label);
|
||||
if (!root) continue;
|
||||
const full = path.resolve(root.path, f.relative);
|
||||
try {
|
||||
const raw = fs.readFileSync(full, 'utf-8');
|
||||
if (raw.toLowerCase().includes(q)) {
|
||||
const idx = raw.toLowerCase().indexOf(q);
|
||||
const start = Math.max(0, idx - 60);
|
||||
const snippet = raw.substring(start, idx + q.length + 80).replace(/\n/g, ' ');
|
||||
results.push({
|
||||
label: f.label,
|
||||
relative: f.relative,
|
||||
name: f.name,
|
||||
dir: f.dir,
|
||||
snippet: (start > 0 ? '...' : '') + snippet + '...',
|
||||
});
|
||||
}
|
||||
} catch (_) { /* skip */ }
|
||||
}
|
||||
results.sort((a, b) => a.name.localeCompare(b.name, 'zh-CN'));
|
||||
res.json(results.slice(0, 50));
|
||||
});
|
||||
|
||||
// Static frontend
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.listen(CONFIG.port, CONFIG.host, () => {
|
||||
console.log(`KB Server running at http://0.0.0.0:${CONFIG.port}`);
|
||||
console.log(`Content roots: ${contentRoots.map(r => r.path).join(', ')}`);
|
||||
});
|
||||
Reference in New Issue
Block a user