Skip to content

Commit 103a8db

Browse files
Merge pull request ipfs#1335 from ElPaisano/ci-cd-test/markdownlint
Add Markdownlint Github action
2 parents 0e9d373 + fb40a2b commit 103a8db

File tree

2 files changed

+339
-0
lines changed

2 files changed

+339
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: markdownlint check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
markdownlint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: markdownlint-cli
10+
uses: nosborn/github-action-markdown-cli@v3.2.0
11+
with:
12+
files: .
13+
config_file: .markdownlint.jsonc
14+

.markdownlint.jsonc

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
{
2+
// Example markdownlint JSON(C) configuration with all properties set to their default value
3+
4+
// Default state for all rules
5+
"default": false,
6+
7+
// Path to configuration file to extend
8+
"extends": null,
9+
10+
// MD001/heading-increment/header-increment - Heading levels should only increment by one level at a time
11+
// Enforces bullet 1 of https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#titles
12+
"MD001": true,
13+
14+
// MD003/heading-style/header-style - Heading style
15+
// Pretty sure we do this implicitly
16+
// Enforces a heading style like the following
17+
//
18+
// # Title
19+
// ## Subheading
20+
"MD003": {
21+
// Heading style
22+
"style": "atx"
23+
},
24+
25+
// MD004/ul-style - Unordered list style
26+
// Enforces https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#unordered-lists
27+
"MD004": {
28+
// List style
29+
"style": "dash"
30+
},
31+
32+
// MD005/list-indent - Inconsistent indentation for list items at the same level
33+
// Seems implicitly related to https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#unordered-lists
34+
"MD005": true,
35+
36+
// MD007/ul-indent - Unordered list indentation
37+
// Pretty sure we enforce 2 spaces indnetation
38+
"MD007": {
39+
// Spaces for indent
40+
"indent": 2,
41+
// Whether to indent the first level of the list
42+
"start_indented": false,
43+
// Spaces for first level indent (when start_indented is set)
44+
"start_indent": 2
45+
},
46+
47+
// MD009/no-trailing-spaces - Trailing spaces
48+
// Seems like something good to have
49+
"MD009": {
50+
// Spaces for line break
51+
"br_spaces": 2,
52+
// Allow spaces for empty lines in list items
53+
"list_item_empty_lines": false,
54+
// Include unnecessary breaks
55+
"strict": false
56+
},
57+
58+
// MD010/no-hard-tabs - Hard tabs
59+
// Not sure if we want to enforce this, seems like it would be a good idea?
60+
"MD010": false,
61+
62+
// MD011/no-reversed-links - Reversed link syntax
63+
// Seems obvious, probably good to enforce
64+
"MD011": true,
65+
66+
// MD012/no-multiple-blanks - Multiple consecutive blank lines
67+
// Seems obvious, probably good to enforce
68+
"MD012": true,
69+
70+
// MD013/line-length - Line length
71+
// Very much unsure on this one
72+
"MD013": {
73+
// Number of characters
74+
"line_length": 80,
75+
// Number of characters for headings
76+
"heading_line_length": 80,
77+
// Number of characters for code blocks
78+
"code_block_line_length": 80,
79+
// Include code blocks
80+
"code_blocks": true,
81+
// Include tables
82+
"tables": true,
83+
// Include headings
84+
"headings": true,
85+
// Include headings
86+
"headers": true,
87+
// Strict length checking
88+
"strict": false,
89+
// Stern length checking
90+
"stern": false
91+
},
92+
93+
// MD014/commands-show-output - Dollar signs used before commands without showing output
94+
// Seems obvious, probably good to enforce
95+
"MD014": true,
96+
97+
// MD018/no-missing-space-atx - No space after hash on atx style heading
98+
// Seems to be something we already do anyways
99+
"MD018": true,
100+
101+
// MD019/no-multiple-space-atx - Multiple spaces after hash on atx style heading
102+
// Seems to be something we already do anyways
103+
"MD019": true,
104+
105+
// MD020/no-missing-space-closed-atx - No space inside hashes on closed atx style heading
106+
// Seems irrelvant since we are using atxc headings
107+
"MD020": false,
108+
109+
// MD021/no-multiple-space-closed-atx - Multiple spaces inside hashes on closed atx style heading
110+
// Seems irrelvant since we are using atxc headings
111+
"MD021": false,
112+
113+
// MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
114+
// Seems to be something we already do anyways
115+
"MD022": {
116+
// Blank lines above heading
117+
"lines_above": 1,
118+
// Blank lines below heading
119+
"lines_below": 1
120+
},
121+
122+
// MD023/heading-start-left/header-start-left - Headings must start at the beginning of the line
123+
// Seems to be something we already do anyways
124+
"MD023": true,
125+
126+
// MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
127+
// Seems to be a good practice
128+
"MD024": {
129+
// Only check sibling headings
130+
// Added this in case we start doing changelogs
131+
"siblings_only": true
132+
},
133+
134+
// MD025/single-title/single-h1 - Multiple top-level headings in the same document
135+
// Enforces bullet 2 of https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#titles
136+
"MD025": {
137+
// Heading level
138+
"level": 1,
139+
// RegExp for matching title in front matter
140+
"front_matter_title": "^\\s*title\\s*[:=]"
141+
},
142+
143+
// MD026/no-trailing-punctuation - Trailing punctuation in heading
144+
// Enforces bullet 3 of https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#titles
145+
"MD026": {
146+
// Punctuation characters
147+
"punctuation": ".,;:!。,;:!"
148+
},
149+
150+
// MD027/no-multiple-space-blockquote - Multiple spaces after blockquote symbol
151+
// Seems like a good practice
152+
"MD027": true,
153+
154+
// MD028/no-blanks-blockquote - Blank line inside blockquote
155+
// Seems like a good practice
156+
"MD028": true,
157+
158+
// MD029/ol-prefix - Ordered list item prefix
159+
// Pretty sure we enforce this without calling it out
160+
//
161+
// 1.
162+
// 1.
163+
// 1.
164+
"MD029": {
165+
// List style
166+
"style": "one"
167+
},
168+
169+
// MD030/list-marker-space - Spaces after list markers
170+
// Seems like we already do this
171+
"MD030": {
172+
// Spaces for single-line unordered list items
173+
"ul_single": 1,
174+
// Spaces for single-line ordered list items
175+
"ol_single": 1,
176+
// Spaces for multi-line unordered list items
177+
"ul_multi": 1,
178+
// Spaces for multi-line ordered list items
179+
"ol_multi": 1
180+
},
181+
182+
// MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines
183+
// Seems like a good practice / we already do this
184+
"MD031": {
185+
// Include list items
186+
"list_items": true
187+
},
188+
189+
// MD032/blanks-around-lists - Lists should be surrounded by blank lines
190+
// Seems like a good practice / we already do this
191+
"MD032": true,
192+
193+
// MD033/no-inline-html - Inline HTML
194+
// Not sure about this one - do we need to allow any html elements?
195+
196+
"MD033": {
197+
// Allowed elements
198+
"allowed_elements": []
199+
},
200+
201+
// MD034/no-bare-urls - Bare URL used
202+
// Pretty sure we don't enforce this, but I think it would be a good idea
203+
// TODO remove all bare URLS from docs
204+
// We should not have bare urls in the docs
205+
// Once done, set this to true
206+
"MD034": false,
207+
208+
// MD035/hr-style - Horizontal rule style
209+
// Not sure if this matters
210+
"MD035": {
211+
// Horizontal rule style
212+
"style": "consistent"
213+
},
214+
215+
// MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
216+
// Seems like a good rule to have in place
217+
"MD036": {
218+
// Punctuation characters
219+
"punctuation": ".,;:!?。,;:!?"
220+
},
221+
222+
// MD037/no-space-in-emphasis - Spaces inside emphasis markers
223+
// Seems like a good rule to have in place
224+
"MD037": true,
225+
226+
// MD038/no-space-in-code - Spaces inside code span elements
227+
// Seems like a good rule to have in place
228+
"MD038": true,
229+
230+
// MD039/no-space-in-links - Spaces inside link text
231+
// Seems like a good rule to have in place
232+
"MD039": true,
233+
234+
// MD040/fenced-code-language - Fenced code blocks should have a language specified
235+
// Seems like we already do this
236+
"MD040": true,
237+
238+
// MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
239+
// Enforces https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#titles
240+
"MD041": {
241+
// Heading level
242+
"level": 1,
243+
// RegExp for matching title in front matter
244+
"front_matter_title": "^\\s*title\\s*[:=]"
245+
},
246+
247+
// MD042/no-empty-links - No empty links
248+
// Seems like a good rule to have in place
249+
"MD042": true,
250+
251+
// MD043/required-headings/required-headers - Required heading structure
252+
// TODO
253+
// We may want to utilize this rule, not sure what the struct would be
254+
"MD043": {
255+
// List of headings
256+
"headings": [],
257+
// List of headings
258+
"headers": []
259+
},
260+
261+
// MD044/proper-names - Proper names should have the correct capitalization
262+
// TODO
263+
// Determine if we want to use this,
264+
// Could be use for things like JavaScript, Python, LibP2P, etc.
265+
// May cause issues
266+
"MD044": {
267+
// List of proper names
268+
"names": [],
269+
// Include code blocks
270+
"code_blocks": false,
271+
// Include HTML elements
272+
"html_elements": false
273+
},
274+
275+
// MD045/no-alt-text - Images should have alternate text (alt text)
276+
// Enforces https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#alt-text
277+
"MD045": true,
278+
279+
// MD046/code-block-style - Code block style
280+
// Seems like we already enforce this
281+
"MD046": {
282+
// Block style
283+
"style": "fenced"
284+
},
285+
286+
// MD047/single-trailing-newline - Files should end with a single newline character
287+
// Not sure if we enforce this, but seems like a good practice
288+
"MD047": true,
289+
290+
// MD048/code-fence-style - Code fence style
291+
// Seems like we already enforce this
292+
"MD048": {
293+
// Code fence style
294+
"style": "backtick"
295+
},
296+
297+
// MD049/emphasis-style - Emphasis style should be consistent
298+
// Enforces https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#italics
299+
"MD049": {
300+
// Emphasis style should be consistent
301+
"style": "underscore"
302+
},
303+
304+
// MD050/strong-style - Strong style should be consistent
305+
// Enforces https://docs.ipfs.tech/community/contribute/grammar-formatting-and-style/#bold-text
306+
"MD050": {
307+
// Strong style should be consistent
308+
"style": "asterisk"
309+
},
310+
311+
// MD051/link-fragments - Link fragments should be valid
312+
// Seems like a good rule, markdow-link-check should also catch this
313+
"MD051": true,
314+
315+
// MD052/reference-links-images - Reference links and images should use a label that is defined
316+
"MD052": true,
317+
318+
// MD053/link-image-reference-definitions - Link and image reference definitions should be needed
319+
"MD053": {
320+
// Ignored definitions
321+
"ignored_definitions": [
322+
"//"
323+
]
324+
}
325+
}

0 commit comments

Comments
 (0)