@alauda/doom 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/lint.d.ts +4 -0
- package/lib/cli/lint.js +8 -4
- package/lib/cli/translate.js +1 -1
- package/lib/eslint.d.ts +1 -1
- package/lib/eslint.js +23 -7
- package/lib/plugins/auto-sidebar/utils.js +1 -1
- package/lib/plugins/replace/parse-toc.js +1 -1
- package/lib/plugins/replace/utils.d.ts +0 -4
- package/lib/plugins/replace/utils.js +0 -12
- package/lib/remark-lint/constants.d.ts +1 -0
- package/lib/remark-lint/constants.js +1 -0
- package/lib/remark-lint/index.d.ts +17 -0
- package/lib/remark-lint/index.js +21 -0
- package/lib/remark-lint/list-item-punctuation.d.ts +2 -0
- package/lib/remark-lint/list-item-punctuation.js +72 -0
- package/lib/remark-lint/list-item-size.d.ts +2 -0
- package/lib/remark-lint/list-item-size.js +15 -0
- package/lib/remark-lint/list-table-introduction.d.ts +2 -0
- package/lib/remark-lint/list-table-introduction.js +17 -0
- package/lib/remark-lint/maximum-link-content-length.d.ts +2 -0
- package/lib/remark-lint/maximum-link-content-length.js +29 -0
- package/lib/remark-lint/no-deep-heading.d.ts +2 -0
- package/lib/remark-lint/no-deep-heading.js +13 -0
- package/lib/remark-lint/no-deep-list.d.ts +2 -0
- package/lib/remark-lint/no-deep-list.js +14 -0
- package/lib/remark-lint/no-empty-table-cell.d.ts +2 -0
- package/lib/remark-lint/no-empty-table-cell.js +12 -0
- package/lib/remark-lint/no-heading-punctuation.d.ts +2 -0
- package/lib/remark-lint/no-heading-punctuation.js +28 -0
- package/lib/remark-lint/no-heading-special-characters.d.ts +2 -0
- package/lib/remark-lint/no-heading-special-characters.js +26 -0
- package/lib/remark-lint/no-heading-sup-sub.d.ts +2 -0
- package/lib/remark-lint/no-heading-sup-sub.js +16 -0
- package/lib/remark-lint/no-paragraph-indent.d.ts +2 -0
- package/lib/remark-lint/no-paragraph-indent.js +27 -0
- package/lib/remark-lint/table-size.d.ts +2 -0
- package/lib/remark-lint/table-size.js +14 -0
- package/lib/remark-lint/unit-case.d.ts +2 -0
- package/lib/remark-lint/unit-case.js +29 -0
- package/lib/remarkrc.d.ts +4 -0
- package/lib/remarkrc.js +58 -0
- package/lib/shared/helpers.d.ts +5 -1
- package/lib/shared/helpers.js +13 -1
- package/lib/shared/types.d.ts +1 -1
- package/package.json +34 -17
- package/pyodide/package.json +1 -1
- package/styles/global.scss +5 -5
package/lib/cli/lint.d.ts
CHANGED
package/lib/cli/lint.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { logger } from '@rspress/shared/logger';
|
|
2
3
|
import { Command } from 'commander';
|
|
3
4
|
import { ESLint } from 'eslint';
|
|
5
|
+
import { cyan } from 'yoctocolors';
|
|
4
6
|
import doom from '../eslint.js';
|
|
5
7
|
import { loadConfig } from './load-config.js';
|
|
6
8
|
export const lintCommand = new Command('lint')
|
|
7
9
|
.description('Lint the documentation')
|
|
8
10
|
.argument('[root]', 'Root directory of the documentation')
|
|
11
|
+
.option('-g, --glob <path...>', 'Glob patterns of source dirs/files to lint', '**/*.{js,jsx,ts,tsx,md,mdx}')
|
|
12
|
+
.option('--no-cspell', 'Disable cspell linting')
|
|
9
13
|
.action(async function (root) {
|
|
10
|
-
const globalOptions = this.optsWithGlobals();
|
|
14
|
+
const { cspell, glob, ...globalOptions } = this.optsWithGlobals();
|
|
11
15
|
const { config } = await loadConfig(root, globalOptions);
|
|
12
16
|
const docsDir = config.root;
|
|
13
17
|
const eslint = new ESLint({
|
|
14
18
|
cwd: docsDir,
|
|
15
19
|
overrideConfigFile: true,
|
|
16
20
|
// @ts-expect-error -- stronger types
|
|
17
|
-
overrideConfig: await doom(config.lint?.cspellOptions),
|
|
21
|
+
overrideConfig: await doom(cspell ? config.lint?.cspellOptions : null),
|
|
18
22
|
});
|
|
19
|
-
logger.start(
|
|
20
|
-
const results = await eslint.lintFiles(
|
|
23
|
+
logger.start(`Linting \`${cyan(path.relative(process.cwd(), docsDir))}\`...`);
|
|
24
|
+
const results = await eslint.lintFiles(glob);
|
|
21
25
|
const { error, warning } = results.reduce((count, result) => ({
|
|
22
26
|
error: count.error + result.errorCount,
|
|
23
27
|
warning: count.warning + result.warningCount,
|
package/lib/cli/translate.js
CHANGED
|
@@ -265,7 +265,7 @@ export const translateCommand = new Command('translate')
|
|
|
265
265
|
.argument('[root]', 'Root directory of the documentation')
|
|
266
266
|
.option('-s, --source <language>', `Document source language, one of ${supportedLanguages}`, 'en')
|
|
267
267
|
.option('-t, --target <language>', `Document target language, one of ${supportedLanguages}`, 'zh')
|
|
268
|
-
.requiredOption('-g, --glob <path...>', 'Glob patterns
|
|
268
|
+
.requiredOption('-g, --glob <path...>', 'Glob patterns of source dirs/files to translate')
|
|
269
269
|
.option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', parseBoolean, false)
|
|
270
270
|
.action(async function (root) {
|
|
271
271
|
const { source, target, glob: globs, copy, force, ...globalOptions } = this.optsWithGlobals();
|
package/lib/eslint.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options } from '@cspell/eslint-plugin';
|
|
2
2
|
import tseslint from 'typescript-eslint';
|
|
3
|
-
declare function doom(cspellOptions?: Options): Promise<tseslint.ConfigArray>;
|
|
3
|
+
declare function doom(cspellOptions?: Options | null): Promise<tseslint.ConfigArray>;
|
|
4
4
|
declare function doom(root: string | URL): Promise<tseslint.ConfigArray>;
|
|
5
5
|
export default doom;
|
package/lib/eslint.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
1
3
|
import cspellRecommended from '@cspell/eslint-plugin/recommended';
|
|
2
4
|
import js from '@eslint/js';
|
|
3
5
|
import react from '@eslint-react/eslint-plugin';
|
|
@@ -6,6 +8,14 @@ import * as mdx from 'eslint-plugin-mdx';
|
|
|
6
8
|
import globals from 'globals';
|
|
7
9
|
import tseslint from 'typescript-eslint';
|
|
8
10
|
import { loadConfig } from './cli/load-config.js';
|
|
11
|
+
const cjsRequire = createRequire(import.meta.url);
|
|
12
|
+
let remarkConfigPath;
|
|
13
|
+
try {
|
|
14
|
+
remarkConfigPath = fileURLToPath(import.meta.resolve('./remarkrc.js'));
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
remarkConfigPath = cjsRequire.resolve('./remarkrc.js');
|
|
18
|
+
}
|
|
9
19
|
async function doom(cspellOptionsOrRoot) {
|
|
10
20
|
let cspellOptions;
|
|
11
21
|
if (typeof cspellOptionsOrRoot === 'string' ||
|
|
@@ -16,6 +26,7 @@ async function doom(cspellOptionsOrRoot) {
|
|
|
16
26
|
else {
|
|
17
27
|
cspellOptions = cspellOptionsOrRoot;
|
|
18
28
|
}
|
|
29
|
+
const cspellEnabled = cspellOptions !== null;
|
|
19
30
|
return tseslint.config([
|
|
20
31
|
{
|
|
21
32
|
ignores: ['**/.yarn', '**/dist', '**/lib', '**/node_modules'],
|
|
@@ -32,16 +43,21 @@ async function doom(cspellOptionsOrRoot) {
|
|
|
32
43
|
},
|
|
33
44
|
{
|
|
34
45
|
files: ['**/en/**/*.{js,jsx,md,mdx,ts,tsx}'],
|
|
35
|
-
extends: [cspellRecommended],
|
|
46
|
+
extends: cspellEnabled ? [cspellRecommended] : [],
|
|
36
47
|
languageOptions: {
|
|
37
48
|
globals: globals.browser,
|
|
49
|
+
parserOptions: {
|
|
50
|
+
remarkConfigPath,
|
|
51
|
+
},
|
|
38
52
|
},
|
|
39
|
-
rules:
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
rules: cspellEnabled
|
|
54
|
+
? {
|
|
55
|
+
'@cspell/spellchecker': [
|
|
56
|
+
'error',
|
|
57
|
+
merge({ autoFix: true }, cspellOptions),
|
|
58
|
+
],
|
|
59
|
+
}
|
|
60
|
+
: {},
|
|
45
61
|
},
|
|
46
62
|
{
|
|
47
63
|
files: ['**/*.mdx'],
|
|
@@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { logger } from '@rspress/shared/logger';
|
|
4
4
|
import { loadFrontMatter } from '@rspress/shared/node-utils';
|
|
5
|
+
import { extractTextAndId } from '../../shared/index.js';
|
|
5
6
|
import { pathExists } from '../../utils/index.js';
|
|
6
|
-
import { extractTextAndId } from '../replace/utils.js';
|
|
7
7
|
export async function detectFilePath(rawPath, extensions) {
|
|
8
8
|
// The params doesn't have extension name, so we need to try to find the file with the extension name.
|
|
9
9
|
let realPath = rawPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Slugger from 'github-slugger';
|
|
2
2
|
import { visitChildren } from 'unist-util-visit-children';
|
|
3
|
-
import { extractTextAndId } from '
|
|
3
|
+
import { extractTextAndId } from '../../shared/index.js';
|
|
4
4
|
export const parseToc = (tree, allDepths) => {
|
|
5
5
|
let title = '';
|
|
6
6
|
const toc = [];
|
|
@@ -2,10 +2,6 @@ import type { Root, Yaml } from 'mdast';
|
|
|
2
2
|
import { type Options } from 'remark-stringify';
|
|
3
3
|
import type { NormalizedReferenceSource, ReferenceItem } from './types.js';
|
|
4
4
|
export declare const RELATIVE_URL_PATTERN: RegExp;
|
|
5
|
-
/**
|
|
6
|
-
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
7
|
-
*/
|
|
8
|
-
export declare const extractTextAndId: (title: string) => string[];
|
|
9
5
|
export declare const normalizeReferenceItems: (items?: ReferenceItem[]) => Record<string, NormalizedReferenceSource>;
|
|
10
6
|
export declare const stringifySettings: Options;
|
|
11
7
|
export declare const mdProcessor: import("unified").Processor<Root, undefined, undefined, Root, string>;
|
|
@@ -7,18 +7,6 @@ import remarkStringify, {} from 'remark-stringify';
|
|
|
7
7
|
import { unified } from 'unified';
|
|
8
8
|
import { red } from 'yoctocolors';
|
|
9
9
|
export const RELATIVE_URL_PATTERN = /^\.\.?\//;
|
|
10
|
-
/**
|
|
11
|
-
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
12
|
-
*/
|
|
13
|
-
export const extractTextAndId = (title) => {
|
|
14
|
-
const customIdReg = /\\?\{#[^}]*\}/;
|
|
15
|
-
const text = title.replace(customIdReg, '').trimEnd();
|
|
16
|
-
const customId = title.match(customIdReg)?.[0]?.slice(2, -1) || '';
|
|
17
|
-
return [
|
|
18
|
-
text.replace(/\\{2}/g, '').replace(/(?:[^\\]\\([[\]]))+/g, '$1'),
|
|
19
|
-
customId,
|
|
20
|
-
];
|
|
21
|
-
};
|
|
22
10
|
export const normalizeReferenceItems = (items = []) => items.reduce((acc, curr) => {
|
|
23
11
|
for (const source of curr.sources) {
|
|
24
12
|
if (source.name in acc) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PUNCTUATION_REGEX: RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PUNCTUATION_REGEX = /\p{P}/u;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Root } from 'mdast';
|
|
2
|
+
import type { Plugin } from 'unified';
|
|
3
|
+
export * from './list-item-punctuation.ts';
|
|
4
|
+
export * from './list-item-size.ts';
|
|
5
|
+
export * from './list-table-introduction.ts';
|
|
6
|
+
export * from './maximum-link-content-length.ts';
|
|
7
|
+
export * from './no-deep-heading.ts';
|
|
8
|
+
export * from './no-deep-list.ts';
|
|
9
|
+
export * from './no-empty-table-cell.ts';
|
|
10
|
+
export * from './no-heading-punctuation.ts';
|
|
11
|
+
export * from './no-heading-special-characters.ts';
|
|
12
|
+
export * from './no-heading-sup-sub.ts';
|
|
13
|
+
export * from './no-paragraph-indent.ts';
|
|
14
|
+
export * from './table-size.ts';
|
|
15
|
+
export * from './unit-case.ts';
|
|
16
|
+
declare const doomLint: Plugin<[], Root>;
|
|
17
|
+
export default doomLint;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import remarkMessageControl from 'remark-message-control';
|
|
2
|
+
export * from "./list-item-punctuation.js";
|
|
3
|
+
export * from "./list-item-size.js";
|
|
4
|
+
export * from "./list-table-introduction.js";
|
|
5
|
+
export * from "./maximum-link-content-length.js";
|
|
6
|
+
export * from "./no-deep-heading.js";
|
|
7
|
+
export * from "./no-deep-list.js";
|
|
8
|
+
export * from "./no-empty-table-cell.js";
|
|
9
|
+
export * from "./no-heading-punctuation.js";
|
|
10
|
+
export * from "./no-heading-special-characters.js";
|
|
11
|
+
export * from "./no-heading-sup-sub.js";
|
|
12
|
+
export * from "./no-paragraph-indent.js";
|
|
13
|
+
export * from "./table-size.js";
|
|
14
|
+
export * from "./unit-case.js";
|
|
15
|
+
const doomLint = function () {
|
|
16
|
+
this.use(() => remarkMessageControl({
|
|
17
|
+
name: 'lint',
|
|
18
|
+
source: ['doom-lint', 'remark-lint'],
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
export default doomLint;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { toString } from 'mdast-util-to-string';
|
|
2
|
+
import { lintRule } from 'unified-lint-rule';
|
|
3
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
4
|
+
import { PUNCTUATION_REGEX } from "./constants.js";
|
|
5
|
+
const ALLOWED_PUNCTUATIONS = new Set([';', '.']);
|
|
6
|
+
export const listItemPunctuation = lintRule('doom-lint:list-item-punctuation', (root, vfile) => {
|
|
7
|
+
visitParents(root, 'list', (list, parents) => {
|
|
8
|
+
const listItems = list.children;
|
|
9
|
+
if (listItems.length < 2) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const firstItem = listItems[0];
|
|
13
|
+
const last = firstItem.children.at(-1);
|
|
14
|
+
if (last?.type !== 'paragraph' || last.children.at(-1)?.type !== 'text') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const firstItemText = toString(firstItem);
|
|
18
|
+
const firstItemLastChar = firstItemText.slice(-1);
|
|
19
|
+
const isPunctuation = ![')', ']'].includes(firstItemLastChar) &&
|
|
20
|
+
PUNCTUATION_REGEX.test(firstItemLastChar);
|
|
21
|
+
if (isPunctuation && !ALLOWED_PUNCTUATIONS.has(firstItemLastChar)) {
|
|
22
|
+
vfile.message(`Unexpected list item "${firstItemText}" ends with a punctuation mark "${firstItemLastChar}", remove it`, {
|
|
23
|
+
ancestors: [...parents, list, firstItem],
|
|
24
|
+
place: firstItem.position,
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const size = listItems.length - 1;
|
|
29
|
+
for (const [index, item] of listItems.slice(1).entries()) {
|
|
30
|
+
const last = item.children.at(-1);
|
|
31
|
+
if (!last ||
|
|
32
|
+
last.type !== 'paragraph' ||
|
|
33
|
+
last.children.at(-1)?.type !== 'text') {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const text = toString(item);
|
|
37
|
+
const lastChar = text.slice(-1);
|
|
38
|
+
if (isPunctuation) {
|
|
39
|
+
if (index === size - 1) {
|
|
40
|
+
if (lastChar !== '.') {
|
|
41
|
+
if ((lastChar === ')' && text.includes('(')) ||
|
|
42
|
+
(lastChar === ']' && text.includes('[')) ||
|
|
43
|
+
text.slice(-2) === '."' ||
|
|
44
|
+
text.slice(-2) === ".'") {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
vfile.message(`Last list item "${text}" ends with a punctuation mark "${lastChar}" which should be a period (.) instead`, {
|
|
48
|
+
ancestors: [...parents, list, item],
|
|
49
|
+
place: item.position,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (lastChar !== firstItemLastChar) {
|
|
54
|
+
vfile.message(`list item "${text}" ends with a punctuation mark "${lastChar}", which does not match the first item "${firstItemText}"`, {
|
|
55
|
+
ancestors: [...parents, list, item],
|
|
56
|
+
place: item.position,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (PUNCTUATION_REGEX.test(lastChar)) {
|
|
61
|
+
if ((lastChar === ')' && text.includes('(')) ||
|
|
62
|
+
(lastChar === ']' && text.includes('['))) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
vfile.message(`List item "${text}" ends with a punctuation mark "${lastChar}", remove it`, {
|
|
66
|
+
ancestors: [...parents, list, item],
|
|
67
|
+
place: item.position,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
const MAX_LIST_ITEM_SIZE = 10;
|
|
4
|
+
export const listItemSize = lintRule('doom-lint:list-item-size', (root, vfile) => {
|
|
5
|
+
visitParents(root, 'list', (list, parents) => {
|
|
6
|
+
const size = list.children.length;
|
|
7
|
+
if (size > MAX_LIST_ITEM_SIZE) {
|
|
8
|
+
vfile.message(`List should have at most ${MAX_LIST_ITEM_SIZE} items, but found ${size}`, {
|
|
9
|
+
ancestors: [...parents, list],
|
|
10
|
+
place: list.position,
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
export const listTableIntroduction = lintRule('doom-lint:list-table-introduction', (root, vfile) => {
|
|
4
|
+
visitParents(root, ['list', 'table'], (node_, parents) => {
|
|
5
|
+
const node = node_;
|
|
6
|
+
const parent = parents[parents.length - 1];
|
|
7
|
+
const index = parent.children.indexOf(node);
|
|
8
|
+
const prevSibling = parent.children[index - 1];
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
10
|
+
if (!prevSibling || prevSibling.type === 'heading') {
|
|
11
|
+
vfile.message(`There should be some introductory text before ${node.type}s`, {
|
|
12
|
+
ancestors: [...parents, node],
|
|
13
|
+
place: node.position,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import stringWidth from 'string-width';
|
|
2
|
+
import { lintRule } from 'unified-lint-rule';
|
|
3
|
+
import { visit } from 'unist-util-visit';
|
|
4
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
5
|
+
import { extractTextAndId } from "../shared/helpers.js";
|
|
6
|
+
const MAX_LENGTH = 40;
|
|
7
|
+
export const maximumLinkContentLength = lintRule('doom-lint:maximum-link-content-length', (root, vfile) => {
|
|
8
|
+
visit(root, ['link', 'lintReference'], (node_) => {
|
|
9
|
+
const node = node_;
|
|
10
|
+
visitParents(node, 'text', (text, parents) => {
|
|
11
|
+
let value = text.value;
|
|
12
|
+
try {
|
|
13
|
+
new URL(value);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
;
|
|
18
|
+
[value] = extractTextAndId(value);
|
|
19
|
+
}
|
|
20
|
+
const length = stringWidth(value);
|
|
21
|
+
if (length > MAX_LENGTH) {
|
|
22
|
+
vfile.message(`Link content length \`${length}\` of \`${value}\` is too long, maximum is ${MAX_LENGTH} characters, please shorten it`, {
|
|
23
|
+
ancestors: [...parents, text],
|
|
24
|
+
place: text.position,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
const MAX_HEADING_DEPTH = 5;
|
|
4
|
+
export const noDeepHeading = lintRule('doom-lint:no-deep-heading', (root, vfile) => {
|
|
5
|
+
visitParents(root, 'heading', (heading, parents) => {
|
|
6
|
+
if (heading.depth > MAX_HEADING_DEPTH) {
|
|
7
|
+
vfile.message(`Unexpected deep heading level ${heading.depth}, maximum is ${MAX_HEADING_DEPTH}`, {
|
|
8
|
+
ancestors: [...parents, heading],
|
|
9
|
+
place: heading.position,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
const MAX_LIST_DEPTH = 4;
|
|
4
|
+
export const noDeepList = lintRule('doom-lint:no-deep-list', (root, vfile) => {
|
|
5
|
+
visitParents(root, 'list', (list, parents) => {
|
|
6
|
+
const depth = parents.filter((p) => p.type === 'list').length + 1;
|
|
7
|
+
if (depth > MAX_LIST_DEPTH) {
|
|
8
|
+
vfile.message(`Unexpected list depth ${depth}, maximum is ${MAX_LIST_DEPTH}`, {
|
|
9
|
+
ancestors: [...parents, list],
|
|
10
|
+
place: list.position,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
export const noEmptyTableCell = lintRule('doom-lint:no-empty-table-cell', (root, vfile) => {
|
|
4
|
+
visitParents(root, 'tableCell', (tableCell, parents) => {
|
|
5
|
+
if (!tableCell.children.length) {
|
|
6
|
+
vfile.message('Table cell cannot be empty, please add some content', {
|
|
7
|
+
ancestors: [...parents, tableCell],
|
|
8
|
+
place: tableCell.position,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { toString } from 'mdast-util-to-string';
|
|
3
|
+
import { lintRule } from 'unified-lint-rule';
|
|
4
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
5
|
+
import { PUNCTUATION_REGEX } from "./constants.js";
|
|
6
|
+
const QUESTION_MARKS = new Set(['?', '?']);
|
|
7
|
+
export const noHeadingPunctuation = lintRule('doom-lint:no-heading-punctuation', (root, vfile) => {
|
|
8
|
+
const filename = path.basename(vfile.path, path.extname(vfile.path));
|
|
9
|
+
visitParents(root, 'heading', (heading, parents) => {
|
|
10
|
+
const text = toString(heading);
|
|
11
|
+
const tail = text.slice(-1);
|
|
12
|
+
if (PUNCTUATION_REGEX.test(tail)) {
|
|
13
|
+
if (filename === 'faq' && QUESTION_MARKS.has(tail)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if ((tail === '}' && text.includes('{')) ||
|
|
17
|
+
(tail === ']' && text.includes('[')) ||
|
|
18
|
+
(tail === '>' && text.includes('<')) ||
|
|
19
|
+
(tail === ')' && text.includes('('))) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
vfile.message(`Unexpected character \`${tail}\` at end of heading, remove it`, {
|
|
23
|
+
ancestors: [...parents, heading],
|
|
24
|
+
place: heading.position,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import pluralize from 'pluralize';
|
|
2
|
+
import { lintRule } from 'unified-lint-rule';
|
|
3
|
+
import { visit } from 'unist-util-visit';
|
|
4
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
5
|
+
const SPECIAL_CHARACTER = /[*+/^|~]/;
|
|
6
|
+
export const noHeadingSpecialCharacters = lintRule('doom-lint:no-heading-special-characters', (root, vfile) => {
|
|
7
|
+
visit(root, 'heading', (heading) => {
|
|
8
|
+
visitParents(heading, 'text', (text, parents) => {
|
|
9
|
+
const pos = text.position;
|
|
10
|
+
const raw = String(vfile.value).slice(pos.start.offset, pos.end.offset);
|
|
11
|
+
const matched = [
|
|
12
|
+
...new Set(raw
|
|
13
|
+
.split('')
|
|
14
|
+
.filter((it, index) => (!index || raw[index - 1] !== '\\') &&
|
|
15
|
+
SPECIAL_CHARACTER.test(it))),
|
|
16
|
+
];
|
|
17
|
+
const matchedLength = matched.length;
|
|
18
|
+
if (matchedLength) {
|
|
19
|
+
vfile.message(`Unexpected special ${pluralize('character', matchedLength)} \`${matched.join('`, `')}\` contain${matchedLength === 1 ? 's' : ''} in heading text \`${raw}\`, remove it or use escape character \`\\\` to ignore it`, {
|
|
20
|
+
ancestors: [...parents, heading],
|
|
21
|
+
place: heading.position,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visit } from 'unist-util-visit';
|
|
3
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
4
|
+
const SUP_SUB_REGEX = /<\/?(?:sup|sub)>/;
|
|
5
|
+
export const noHeadingSupSub = lintRule('doom-lint:no-heading-sup-sub', (root, vfile) => {
|
|
6
|
+
visit(root, 'heading', (heading) => {
|
|
7
|
+
visitParents(heading, 'html', (html, parents) => {
|
|
8
|
+
if (SUP_SUB_REGEX.test(html.value)) {
|
|
9
|
+
vfile.message(`Unexpected \`${html.value}\` tag in heading, remove it`, {
|
|
10
|
+
ancestors: [...parents, html],
|
|
11
|
+
place: html.position,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { phrasing } from 'mdast-util-phrasing';
|
|
2
|
+
import pluralize from 'pluralize';
|
|
3
|
+
import { lintRule } from 'unified-lint-rule';
|
|
4
|
+
import { pointStart } from 'unist-util-position';
|
|
5
|
+
import { SKIP, visitParents } from 'unist-util-visit-parents';
|
|
6
|
+
export const noParagraphIndent = lintRule('doom-lint:no-paragraph-indent', (root, vfile) => {
|
|
7
|
+
visitParents(root, (node, parents) => {
|
|
8
|
+
// Do not walk into phrasing.
|
|
9
|
+
if (phrasing(node)) {
|
|
10
|
+
return SKIP;
|
|
11
|
+
}
|
|
12
|
+
const parent = parents.at(-1);
|
|
13
|
+
const start = pointStart(node);
|
|
14
|
+
// Note: it’s rather complex to detect what the expected indent is in block
|
|
15
|
+
// quotes and lists, so let’s only do directly in root for now.
|
|
16
|
+
if (!start ||
|
|
17
|
+
!parent ||
|
|
18
|
+
node.type !== 'paragraph' ||
|
|
19
|
+
parent.type !== 'root') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const actual = start.column - 1;
|
|
23
|
+
if (actual) {
|
|
24
|
+
vfile.message(`Unexpected \`${actual}\` ${pluralize('space', actual)} before paragraph, expected \`0\` spaces, remove \`${actual}\` ${pluralize('space', actual)}`, { ancestors: [...parents, node], place: start });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
export const tableSize = lintRule('doom-lint:table-size', (root, vfile) => {
|
|
4
|
+
visitParents(root, 'table', (table, parents) => {
|
|
5
|
+
const rows = table.children.length;
|
|
6
|
+
const columns = table.children[0].children.length;
|
|
7
|
+
if (columns === 1 || rows === 1) {
|
|
8
|
+
vfile.message('Tables with only one row or only one column are not allowed, please use a list or add an additional row or column', {
|
|
9
|
+
ancestors: [...parents, table],
|
|
10
|
+
place: table.position,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
3
|
+
// cspell:disable-next-line
|
|
4
|
+
const UNIT_CASE_REGEX = /\b\d+(?:\.\d+)?\s*([kmgtpe]i?)\b/gi;
|
|
5
|
+
const VALID_UNITS = new Set([
|
|
6
|
+
'm',
|
|
7
|
+
'k',
|
|
8
|
+
'Ki',
|
|
9
|
+
...['M', 'G', 'T', 'P', 'E'].flatMap((it) => [it, `${it}i`]),
|
|
10
|
+
]);
|
|
11
|
+
const getPairUnit = (unit) => {
|
|
12
|
+
for (const it of VALID_UNITS) {
|
|
13
|
+
if (it.toLowerCase() === unit.toLowerCase()) {
|
|
14
|
+
return it;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const unitCase = lintRule('doom-lint:unit-case', (root, vfile) => {
|
|
19
|
+
visitParents(root, 'text', (text, parents) => {
|
|
20
|
+
for (const [, unit] of text.value.matchAll(UNIT_CASE_REGEX)) {
|
|
21
|
+
if (!VALID_UNITS.has(unit)) {
|
|
22
|
+
vfile.message(`Unexpected unit case "${unit}", use "${getPairUnit(unit)}" instead`, {
|
|
23
|
+
ancestors: [...parents, text],
|
|
24
|
+
place: text.position,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
package/lib/remarkrc.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import remarkDirective from 'remark-directive';
|
|
2
|
+
import remarkFrontmatter from 'remark-frontmatter';
|
|
3
|
+
import remarkGfm from 'remark-gfm';
|
|
4
|
+
// @ts-expect-error -- https://github.com/ilyatitovich/remark-lint-code-block-split-list/issues/2
|
|
5
|
+
import remarkLintCodeBlockSplitList from 'remark-lint-code-block-split-list';
|
|
6
|
+
import remarkLintHeadingIncrement from 'remark-lint-heading-increment';
|
|
7
|
+
// @ts-expect-error -- https://github.com/laysent/remark-lint-plugins/issues/51
|
|
8
|
+
import remarkLintLintMatchPunctuation from 'remark-lint-match-punctuation';
|
|
9
|
+
// import remarkLintMaximumHeadingLength, {
|
|
10
|
+
// type Options,
|
|
11
|
+
// } from 'remark-lint-maximum-heading-length'
|
|
12
|
+
// @ts-expect-error -- https://github.com/laysent/remark-lint-plugins/issues/51
|
|
13
|
+
import remarkLintNoChinesePunctuationInNumber from 'remark-lint-no-chinese-punctuation-in-number';
|
|
14
|
+
import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section';
|
|
15
|
+
import remarkLintNoHeadingContentIndent from 'remark-lint-no-heading-content-indent';
|
|
16
|
+
import remarkLintNoHeadingIndent from 'remark-lint-no-heading-indent';
|
|
17
|
+
import remarkLintNoHiddenTableCell from 'remark-lint-no-hidden-table-cell';
|
|
18
|
+
// @ts-expect-error -- https://github.com/laysent/remark-lint-plugins/issues/51
|
|
19
|
+
import remarkLintNoRepeatPunctuation from 'remark-lint-no-repeat-punctuation';
|
|
20
|
+
import doomLint, { listItemPunctuation, listItemSize, maximumLinkContentLength, noDeepHeading, noDeepList, noEmptyTableCell, noHeadingPunctuation, noHeadingSupSub, noParagraphIndent, tableSize, unitCase, } from "./remark-lint/index.js";
|
|
21
|
+
export default {
|
|
22
|
+
plugins: [
|
|
23
|
+
remarkDirective,
|
|
24
|
+
remarkFrontmatter,
|
|
25
|
+
remarkGfm,
|
|
26
|
+
remarkLintCodeBlockSplitList,
|
|
27
|
+
remarkLintHeadingIncrement,
|
|
28
|
+
remarkLintLintMatchPunctuation,
|
|
29
|
+
// [
|
|
30
|
+
// remarkLintMaximumHeadingLength,
|
|
31
|
+
// {
|
|
32
|
+
// size: 50,
|
|
33
|
+
// stringLength(value) {
|
|
34
|
+
// const [text] = extractTextAndId(value)
|
|
35
|
+
// return stringWidth(text)
|
|
36
|
+
// },
|
|
37
|
+
// } satisfies Options,
|
|
38
|
+
// ],
|
|
39
|
+
remarkLintNoChinesePunctuationInNumber,
|
|
40
|
+
remarkLintNoDuplicateHeadingsInSection,
|
|
41
|
+
remarkLintNoHeadingContentIndent,
|
|
42
|
+
remarkLintNoHeadingIndent,
|
|
43
|
+
remarkLintNoHiddenTableCell,
|
|
44
|
+
remarkLintNoRepeatPunctuation,
|
|
45
|
+
doomLint,
|
|
46
|
+
listItemPunctuation,
|
|
47
|
+
listItemSize,
|
|
48
|
+
maximumLinkContentLength,
|
|
49
|
+
noDeepHeading,
|
|
50
|
+
noDeepList,
|
|
51
|
+
noEmptyTableCell,
|
|
52
|
+
noHeadingPunctuation,
|
|
53
|
+
noHeadingSupSub,
|
|
54
|
+
noParagraphIndent,
|
|
55
|
+
tableSize,
|
|
56
|
+
unitCase,
|
|
57
|
+
],
|
|
58
|
+
};
|
package/lib/shared/helpers.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type { UnversionedVersion } from './types.
|
|
1
|
+
import type { UnversionedVersion } from './types.ts';
|
|
2
2
|
export declare const removeBothEndsSlashes: (str?: string) => string;
|
|
3
3
|
export declare const getPdfName: (lang: string, userBase?: string, title?: string) => string;
|
|
4
4
|
export declare const isExplicitlyUnversioned: (version?: string) => version is UnversionedVersion;
|
|
5
5
|
export declare const isUnversioned: (version?: string) => version is undefined | "" | UnversionedVersion;
|
|
6
6
|
export declare const getUnversionedVersion: (version?: string) => string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
9
|
+
*/
|
|
10
|
+
export declare const extractTextAndId: (title: string) => string[];
|
package/lib/shared/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNVERSIONED, UNVERSIONED_PREFIX } from
|
|
1
|
+
import { UNVERSIONED, UNVERSIONED_PREFIX } from "./constants.js";
|
|
2
2
|
export const removeBothEndsSlashes = (str) => str?.replace(/^\/|\/$/g, '') || '';
|
|
3
3
|
export const getPdfName = (lang, userBase, title) => `${removeBothEndsSlashes(userBase) || title || 'exported'}-${lang}.pdf`;
|
|
4
4
|
export const isExplicitlyUnversioned = (version) => version === UNVERSIONED || !!version?.startsWith(UNVERSIONED_PREFIX);
|
|
@@ -11,3 +11,15 @@ export const getUnversionedVersion = (version) => {
|
|
|
11
11
|
? version.slice(UNVERSIONED_PREFIX.length)
|
|
12
12
|
: version;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
16
|
+
*/
|
|
17
|
+
export const extractTextAndId = (title) => {
|
|
18
|
+
const customIdReg = /\\?\{#[^}]*\}/;
|
|
19
|
+
const text = title.replace(customIdReg, '').trimEnd();
|
|
20
|
+
const customId = title.match(customIdReg)?.[0]?.slice(2, -1) || '';
|
|
21
|
+
return [
|
|
22
|
+
text.replace(/\\{2}/g, '').replace(/(?:[^\\]\\([[\]]))+/g, '$1'),
|
|
23
|
+
customId,
|
|
24
|
+
];
|
|
25
|
+
};
|
package/lib/shared/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": "git+https://github.com/alauda/doom.git",
|
|
@@ -36,57 +36,74 @@
|
|
|
36
36
|
"rspress-plugins"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@cspell/eslint-plugin": "^8.19.4 || ^9.1.
|
|
39
|
+
"@cspell/eslint-plugin": "^8.19.4 || ^9.1.3",
|
|
40
40
|
"@eslint-react/eslint-plugin": "^1.52.2",
|
|
41
|
-
"@inquirer/prompts": "^7.
|
|
41
|
+
"@inquirer/prompts": "^7.6.0",
|
|
42
42
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
43
|
-
"@playwright/browser-chromium": "^1.53.
|
|
44
|
-
"@rsbuild/plugin-react": "^1.3.
|
|
45
|
-
"@rsbuild/plugin-sass": "^1.3.
|
|
46
|
-
"@rsbuild/plugin-svgr": "^1.2.
|
|
43
|
+
"@playwright/browser-chromium": "^1.53.2",
|
|
44
|
+
"@rsbuild/plugin-react": "^1.3.4",
|
|
45
|
+
"@rsbuild/plugin-sass": "^1.3.3",
|
|
46
|
+
"@rsbuild/plugin-svgr": "^1.2.1",
|
|
47
47
|
"@rsbuild/plugin-yaml": "^1.0.2",
|
|
48
48
|
"@rspress/core": "2.0.0-beta.14",
|
|
49
49
|
"@rspress/plugin-algolia": "2.0.0-beta.14",
|
|
50
50
|
"@rspress/plugin-llms": "2.0.0-beta.14",
|
|
51
|
-
"@shikijs/transformers": "^3.
|
|
51
|
+
"@shikijs/transformers": "^3.7.0",
|
|
52
52
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
53
53
|
"chokidar": "^4.0.3",
|
|
54
54
|
"cli-progress": "^3.12.0",
|
|
55
55
|
"clsx": "^2.1.1",
|
|
56
56
|
"commander": "^13.1.0 || ^14.0.0",
|
|
57
57
|
"ejs": "^3.1.10",
|
|
58
|
-
"es-toolkit": "^1.39.
|
|
59
|
-
"eslint": "^9.
|
|
60
|
-
"eslint-plugin-mdx": "^3.
|
|
61
|
-
"globals": "^16.
|
|
58
|
+
"es-toolkit": "^1.39.7",
|
|
59
|
+
"eslint": "^9.30.1",
|
|
60
|
+
"eslint-plugin-mdx": "^3.6.2",
|
|
61
|
+
"globals": "^16.3.0",
|
|
62
62
|
"html-tag-names": "^2.1.0",
|
|
63
63
|
"md-attr-parser": "^1.3.0",
|
|
64
64
|
"mdast-util-mdx": "^3.0.0",
|
|
65
65
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"mdast-util-phrasing": "^4.1.0",
|
|
67
|
+
"mdast-util-to-string": "^4.0.0",
|
|
68
|
+
"mermaid": "^11.8.1",
|
|
69
|
+
"openai": "^5.8.3",
|
|
68
70
|
"openapi-types": "^12.1.3",
|
|
69
71
|
"p-ratelimit": "^1.0.1",
|
|
70
72
|
"pdf-lib": "^1.17.1",
|
|
71
73
|
"pdf-merger-js": "^5.1.2",
|
|
72
74
|
"picomatch": "^4.0.2",
|
|
73
|
-
"playwright": "^1.53.
|
|
75
|
+
"playwright": "^1.53.2",
|
|
76
|
+
"pluralize": "^8.0.0",
|
|
74
77
|
"react-markdown": "^10.1.0",
|
|
75
78
|
"rehype-raw": "^7.0.0",
|
|
76
79
|
"rehype-sanitize": "^6.0.0",
|
|
77
80
|
"remark-directive": "^4.0.0",
|
|
78
81
|
"remark-frontmatter": "^5.0.0",
|
|
79
82
|
"remark-gfm": "^4.0.1",
|
|
83
|
+
"remark-lint-code-block-split-list": "^1.0.0",
|
|
84
|
+
"remark-lint-heading-increment": "^4.0.1",
|
|
85
|
+
"remark-lint-match-punctuation": "^0.2.1",
|
|
86
|
+
"remark-lint-no-chinese-punctuation-in-number": "^0.1.2",
|
|
87
|
+
"remark-lint-no-duplicate-headings-in-section": "^4.0.1",
|
|
88
|
+
"remark-lint-no-heading-content-indent": "^5.0.1",
|
|
89
|
+
"remark-lint-no-heading-indent": "^5.0.1",
|
|
90
|
+
"remark-lint-no-hidden-table-cell": "^1.0.1",
|
|
91
|
+
"remark-lint-no-repeat-punctuation": "^0.1.4",
|
|
80
92
|
"remark-mdx": "^3.1.0",
|
|
93
|
+
"remark-message-control": "^8.0.0",
|
|
81
94
|
"remark-stringify": "^11.0.0",
|
|
82
|
-
"shiki": "^3.
|
|
95
|
+
"shiki": "^3.7.0",
|
|
83
96
|
"simple-git": "^3.28.0",
|
|
97
|
+
"string-width": "^7.2.0",
|
|
84
98
|
"swagger2openapi": "^7.0.8",
|
|
85
99
|
"tinyglobby": "^0.2.14",
|
|
86
100
|
"type-fest": "^4.41.0",
|
|
87
101
|
"typescript": "^5.8.3",
|
|
88
|
-
"typescript-eslint": "^8.
|
|
102
|
+
"typescript-eslint": "^8.36.0",
|
|
89
103
|
"unified": "^11.0.5",
|
|
104
|
+
"unified-lint-rule": "^3.0.1",
|
|
105
|
+
"unist-util-position": "^5.0.0",
|
|
106
|
+
"unist-util-visit-parents": "^6.0.1",
|
|
90
107
|
"x-fetch": "^0.2.6",
|
|
91
108
|
"yaml": "^2.8.0",
|
|
92
109
|
"yoctocolors": "^2.1.1"
|
package/pyodide/package.json
CHANGED
package/styles/global.scss
CHANGED
|
@@ -146,13 +146,13 @@ td {
|
|
|
146
146
|
@include print;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
.rp-list-decimal {
|
|
149
|
+
.rp-list-decimal:not(:has(p)) {
|
|
150
150
|
list-style: none;
|
|
151
151
|
counter-reset: section;
|
|
152
152
|
padding-left: 20px;
|
|
153
|
-
}
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
> li:before {
|
|
155
|
+
counter-increment: section;
|
|
156
|
+
content: counters(section, '.') '. ';
|
|
157
|
+
}
|
|
158
158
|
}
|