-
Notifications
You must be signed in to change notification settings - Fork 0
/
.remarkrc.mjs
83 lines (79 loc) · 2.64 KB
/
.remarkrc.mjs
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
import { resolve } from "path";
import remarkVariables from "./.remark-build/server/remark-variables.mjs";
import remarkIncludes from "./.remark-build/server/remark-includes.mjs";
import remarkTOC from "./.remark-build/server/remark-toc.mjs";
import { remarkLintTeleportDocsLinks } from "./.remark-build/server/lint-teleport-docs-links.mjs";
import {
getVersion,
getVersionRootPath,
} from "./.remark-build/server/docs-helpers.mjs";
import { loadConfig } from "./.remark-build/server/config-docs.mjs";
import {
updatePathsInIncludes,
} from "./.remark-build//server/asset-path-helpers.mjs";
const configFix = {
settings: {
bullet: "-",
ruleRepetition: 3,
fences: true,
incrementListMarker: true,
checkBlanks: true,
resourceLink: true,
emphasis: "*",
tablePipeAlign: false,
tableCellPadding: true,
listItemIndent: 1,
},
plugins: ["frontmatter", "mdx"],
};
const configLint = {
plugins: [
"frontmatter",
"mdx",
"preset-lint-markdown-style-guide",
["lint-emphasis-marker", false],
["lint-unordered-list-marker-style", false],
["lint-table-pipe-alignment", false],
["lint-table-cell-padding", false],
["lint-maximum-line-length", false],
["lint-no-consecutive-blank-lines", false],
["lint-no-emphasis-as-heading", false],
["lint-fenced-code-flag", { allowEmpty: true }],
["lint-file-extension", false],
["lint-no-duplicate-headings", false],
["lint-list-item-spacing", { checkBlanks: true }],
["lint-no-shell-dollars", false],
["lint-list-item-indent", "space"],
["lint-ordered-list-marker-value", false],
["lint-maximum-heading-length", false],
["lint-no-shortcut-reference-link", false],
["lint-no-file-name-irregular-characters", false],
[remarkTOC],
[
remarkIncludes, // Lints (!include.ext!) syntax
{
lint: true,
rootDir: (vfile) => getVersionRootPath(vfile.path),
updatePaths: updatePathsInIncludes,
},
],
[
remarkVariables, // Lints (=variable=) syntax
{
lint: true,
variables: (vfile) => {
return loadConfig(getVersion(vfile.path)).variables || {};
},
},
],
// validate-links must be run after remarkVariables since some links
// include variables in their references, e.g.,
// [CM-08 Information System Component Inventory]((=fedramp.control_url=)CM-8)
["validate-links", { repository: false }],
[remarkLintTeleportDocsLinks],
// Disabling the remarkLintFrontmatter check until we fix
// gravitational/docs#80
// [remarkLintFrontmatter, ["error"]],
],
};
export default process.env.FIX ? configFix : configLint;