-
Notifications
You must be signed in to change notification settings - Fork 24
/
.remarkrc.js
100 lines (96 loc) · 3.23 KB
/
.remarkrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// @ts-check
import { readFileSync } from "node:fs";
import { remarkLintLocalLinksValid } from "@portone-io/lint-local-links-valid";
import { remarkLintNoJamo } from "@portone-io/lint-no-jamo";
import { load } from "js-yaml";
import stringWidth from "string-width";
const redirects = load(
readFileSync("./src/routes/(root)/docs/_redir.yaml", "utf8"),
);
if (!Array.isArray(redirects)) {
throw new Error("Expected an array of redirects");
}
export default {
plugins: [
"remark-frontmatter",
["remark-gfm", { tableCellPadding: false, stringLength: stringWidth }],
["remark-lint-blockquote-indentation", 2],
["remark-lint-code-block-style", "fenced"],
[
"remark-lint-checkbox-character-style",
{
checked: "x",
unchecked: " ",
},
],
"remark-lint-checkbox-content-indent",
"remark-lint-definition-spacing",
["remark-lint-emphasis-marker", "_"],
"remark-lint-fenced-code-flag",
["remark-lint-fenced-code-marker", "`"],
"remark-lint-final-newline",
["remark-lint-first-heading-level", 2],
"remark-lint-hard-break-spaces",
"remark-lint-heading-increment",
["remark-lint-heading-style", "atx"],
["remark-lint-linebreak-style", "unix"],
["remark-lint-link-title-style", '"'],
"remark-lint-list-item-bullet-indent",
"remark-lint-list-item-content-indent",
["remark-lint-list-item-indent", "one"],
"remark-lint-list-item-spacing",
"remark-lint-no-blockquote-without-marker",
"remark-lint-no-consecutive-blank-lines",
"remark-lint-no-duplicate-defined-urls",
"remark-lint-no-duplicate-definitions",
"remark-lint-no-empty-url",
"remark-lint-no-file-name-consecutive-dashes",
["remark-lint-no-file-name-irregular-characters", "\\.a-z0-9-"],
"remark-lint-no-file-name-outer-dashes",
"remark-lint-no-heading-content-indent",
"remark-lint-no-heading-indent",
"remark-lint-no-heading-like-paragraph",
"remark-lint-no-inline-padding",
["remark-lint-no-missing-blank-lines", { exceptTightLists: true }],
"remark-lint-no-paragraph-content-indent",
"remark-lint-no-shortcut-reference-image",
"remark-lint-no-table-indentation",
"remark-lint-no-tabs",
"remark-lint-no-undefined-references",
"remark-lint-no-unused-definitions",
["remark-lint-ordered-list-marker-style", "."],
"remark-lint-ordered-list-marker-value",
["remark-lint-rule-style", "---"],
["remark-lint-strikethrough-marker", "~~"],
["remark-lint-strong-marker", "*"],
["remark-lint-table-cell-padding", "compact"],
"remark-lint-table-pipe-alignment",
"remark-lint-table-pipes",
["remark-lint-unordered-list-marker-style", "-"],
[
remarkLintLocalLinksValid,
{
baseDir: "./src/routes/(root)",
excludePaths: ["/api"],
redirects: Object.fromEntries(
redirects.map((redir) => {
const { old: from, new: to } = redir;
return [prefix(from), to];
function prefix(str) {
if (str.startsWith("/")) {
return "docs" + str;
}
return str;
}
}),
),
},
],
[remarkLintNoJamo],
],
settings: {
bullet: "-",
rule: "-",
emphasis: "_",
},
};