chore: import upstream snapshot with attribution
docmd CI verification / verify (push) Failing after 0s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:31:55 +08:00
commit 6db8fca185
437 changed files with 68762 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025-present docmd.io
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+25
View File
@@ -0,0 +1,25 @@
# @docmd/plugin-math
Adds LaTeX mathematics to your docmd site via KaTeX - inline `$...$` and block `$$...$$` syntax, rendered client-side with no server overhead. An optional plugin, installed separately.
```bash
docmd add math
```
```js
$E = mc^2$
$$
\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}
$$
```
Part of the **[docmd](https://github.com/docmd-io/docmd)** documentation engine.
## Documentation
See **[docs.docmd.io](https://docs.docmd.io)** for full usage and API reference.
## License
MIT
+61
View File
@@ -0,0 +1,61 @@
{
"name": "@docmd/plugin-math",
"version": "0.8.12",
"description": "Mathematics (KaTeX/LaTeX) plugin for docmd.",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"docmd": {
"key": "math",
"kind": "plugin",
"displayName": "Math",
"tagline": "Mathematics (KaTeX/LaTeX) plugin for docmd.",
"capabilities": [
"markdown",
"assets"
]
},
"scripts": {
"build": "tsc"
},
"files": [
"dist"
],
"engines": {
"node": ">=18"
},
"dependencies": {
"katex": "^0.17.0",
"markdown-it-texmath": "^1.0.0"
},
"devDependencies": {
"@docmd/api": "workspace:*"
},
"keywords": [
"docmd",
"plugin",
"math",
"latex",
"katex",
"markdown",
"documentation",
"minimalist",
"zero-config",
"site-generator",
"docs"
],
"author": {
"name": "Ghazi",
"url": "https://mgks.dev"
},
"repository": {
"type": "git",
"url": "git+https://github.com/docmd-io/docmd.git"
},
"bugs": {
"url": "https://github.com/docmd-io/docmd/issues"
},
"homepage": "https://docmd.io",
"funding": "https://github.com/sponsors/mgks",
"license": "MIT"
}
+50
View File
@@ -0,0 +1,50 @@
/**
* --------------------------------------------------------------------
* docmd : the zero-config documentation engine.
*
* @package @docmd/plugin-math
* @website https://docmd.io
* @repository https://github.com/docmd-io/docmd
* @license MIT
* @copyright Copyright (c) 2025-present docmd.io
*
* [docmd-source] - Please do not remove this header.
* --------------------------------------------------------------------
*/
import texmath from 'markdown-it-texmath';
import katex from 'katex';
import type { PluginDescriptor } from '@docmd/api';
export const plugin: PluginDescriptor = {
name: 'math',
version: '0.8.12',
capabilities: ['markdown', 'assets']
};
export function markdownSetup(md: any) {
// Suppress KaTeX's "quirks mode" warning - irrelevant in Node.js
const origWarn = console.warn;
console.warn = (...args: any[]) => {
if (typeof args[0] === 'string' && args[0].includes('quirks mode')) return;
origWarn.apply(console, args);
};
md.use(texmath, { engine: katex, delimiters: 'dollars', katexOptions: { macros: { "\\RR": "\\mathbb{R}" } } });
console.warn = origWarn;
}
export function getAssets() {
return [
{
url: 'https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css',
type: 'css',
location: 'head',
// Conditional loading (new in 0.8.7): only inject KaTeX's stylesheet
// on pages that actually have rendered math (KaTeX emits `class="katex"`
// on every formula and `class="katex-display"` on display math). On
// pages with no math the CSS request is skipped entirely, saving the
// ~30 KB katex.min.css fetch plus the render cost on mobile.
condition: { pageHtmlMatches: ['class="katex"', 'class="katex-display"'] }
}
];
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"strict": false
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts"]
}