Skip to content

Commit 53b7318

Browse files
authored
feat: markdown lint (#1307)
1 parent e024a49 commit 53b7318

File tree

4 files changed

+1348
-115
lines changed

4 files changed

+1348
-115
lines changed

.remarkrc.mjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import remarkFrontmatter from 'remark-frontmatter';
2+
import rlFmSchema from '@julian_cataldo/remark-lint-frontmatter-schema';
3+
4+
5+
const remarkConfig = {
6+
plugins: [
7+
"remark-preset-lint-consistent",
8+
"remark-preset-lint-recommended",
9+
"remark-preset-lint-markdown-style-guide",
10+
["remark-lint-maximum-line-length", false],
11+
["maximum-heading-length", false],
12+
["remark-lint-ordered-list-marker-value", [1, "ordered"]],
13+
remarkFrontmatter,
14+
[
15+
rlFmSchema,
16+
{
17+
schemas: {
18+
'./blog/creative-work.schema.yaml': [
19+
'./blog/en/blog/*.md',
20+
'./blog/zh/blog/*.md',
21+
],
22+
},
23+
},
24+
],
25+
],
26+
};
27+
28+
export default remarkConfig;

blog/creative-work.schema.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
type: object
2+
additionalProperties: false
3+
properties:
4+
title:
5+
type: string
6+
tags:
7+
type: array
8+
items:
9+
type: string
10+
enum:
11+
- Case Studies
12+
- Community
13+
- Ecosystem
14+
- Authentication
15+
- Security
16+
- Plugins
17+
keywords:
18+
type: array
19+
image:
20+
type: string
21+
description:
22+
type: string
23+
authors:
24+
type: array
25+
items:
26+
type: object
27+
required:
28+
- name
29+
- title
30+
properties:
31+
name:
32+
type: string
33+
title:
34+
type: string
35+
url:
36+
type: string
37+
image_url:
38+
type: string
39+
required:
40+
- title
41+
- tags
42+
- keywords

package.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"prepare-data": "yarn sync-docs && yarn generate-repos-info && yarn generate-picked-posts"
3939
},
4040
"devDependencies": {
41+
"@julian_cataldo/remark-lint-frontmatter-schema": "^3.6.2",
4142
"@typescript-eslint/eslint-plugin": "^5.17.0",
4243
"@typescript-eslint/parser": "^5.17.0",
4344
"eslint": "^8.2.0",
@@ -49,12 +50,19 @@
4950
"eslint-plugin-yml": "^0.14.0",
5051
"husky": ">=6",
5152
"lint-staged": ">=10",
53+
"remark": "^14.0.2",
54+
"remark-cli": "^11.0.0",
55+
"remark-frontmatter": "^4.0.1",
56+
"remark-preset-lint-consistent": "^5.1.1",
57+
"remark-preset-lint-markdown-style-guide": "^5.1.2",
58+
"remark-preset-lint-recommended": "^6.1.2",
5259
"stylelint": "^14.6.1",
5360
"stylelint-config-standard": "^25.0.0"
5461
},
5562
"lint-staged": {
5663
"*.{js,jsx,ts,tsx}": "eslint --cache --fix",
5764
"*.{yml,yaml}": "eslint --cache --fix",
58-
"*.{scss,css}": "stylelint --cache --fix"
65+
"*.{scss,css}": "stylelint --cache --fix",
66+
"*.{md}": "remark ./blog/{en,zh}/blog/**/*.md --quiet"
5967
}
6068
}

0 commit comments

Comments
 (0)