Skip to content

Commit d667dcb

Browse files
committed
Add a markdownlint config file
1 parent af980fc commit d667dcb

1 file changed

Lines changed: 160 additions & 0 deletions

File tree

.markdownlintrc

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{ // -*- jsonc -*-
2+
// Copyright 2025 Google LLC
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
// Markdownlint linter configuration for this project.
18+
//
19+
// Note: there are multiple programs programs named "markdownlint". We use
20+
// https://github.com/igorshubovych/markdownlint-cli/, which is the one you
21+
// get with "brew install markdownlint" on MacOS.
22+
//
23+
// These settings try to stay close to the Google Markdown Style as
24+
// described at https://google.github.io/styleguide/docguide/style.html
25+
// with very few differences.
26+
//
27+
// For a list of possible configuration options, see the following page:
28+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
29+
// (Beware that the above looks similar but is NOT the same as the page
30+
// https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md.)
31+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
33+
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",
34+
35+
// Require ATX-style headings.
36+
// https://google.github.io/styleguide/docguide/style.html#atx-style-headings
37+
"headings": {
38+
"style": "atx"
39+
},
40+
41+
// Google style does not require that the first line of a file is a heading
42+
// for the title; it only states that the first heading should be a level 1.
43+
// https://google.github.io/styleguide/docguide/style.html#document-layout
44+
"first-line-heading": false,
45+
46+
// The Google style does not define what to do about trailing punctuation in
47+
// headings. The markdownlint default disallows exclamation points, which
48+
// seems likely to be more annoying than useful – I have definitely seen
49+
// people use exclamation points in headings in README files on GitHub.
50+
// This setting removes exclamation point from the banned characters.
51+
"no-trailing-punctuation": {
52+
"punctuation": ".,;:。,;:"
53+
},
54+
55+
// No trailing spaces.
56+
// https://google.github.io/styleguide/docguide/style.html#trailing-whitespace
57+
"whitespace": {
58+
"br_spaces": 0
59+
},
60+
61+
// Google style is 80 characters.
62+
// Google style exempts some constructs from the line-length limit:
63+
// https://google.github.io/styleguide/docguide/style.html#exceptions
64+
"line-length": {
65+
"line_length": 80,
66+
"code_block_line_length": 80,
67+
"heading_line_length": 80,
68+
"code_blocks": false,
69+
"headings": false,
70+
"tables": false
71+
},
72+
73+
// Google Markdown style specifies 2 spaces after item numbers, 3 spaces
74+
// after bullets, so that the text itself is consistently indented 4 spaces.
75+
// https://google.github.io/styleguide/docguide/style.html#nested-list-spacing
76+
"list-marker-space": {
77+
"ol_multi": 2,
78+
"ol_single": 2,
79+
"ul_multi": 3,
80+
"ul_single": 3
81+
},
82+
83+
"ul-indent": {
84+
"indent": 4
85+
},
86+
87+
// Bare URLs are allowed in GitHub-flavored Markdown and in Google’s style.
88+
"no-bare-urls": false,
89+
90+
// Basic Markdown allows raw HTML. Both GitHub & PyPI support subsets of
91+
// HTML, though it's unclear what subset PyPI supports. Google's style guide
92+
// recommends against using raw HTML, but does allow it. (C.f. the bottom of
93+
// https://google.github.io/styleguide/docguide/style.html) Google's in-house
94+
// documentation system allows many inline and block-level tags, but strips
95+
// others that can pose security risks (e.g., <object> and standalone <svg>).
96+
// The list below tries to capture the intersection of what GitHub allows
97+
// (c.f. https://github.com/github/markup/issues/245#issuecomment-682231577),
98+
// what PyPI seems to allow, what Google allows, and what seems likely to be
99+
// most useful in situations where someone needs to reach for HTML.
100+
"html": {
101+
"allowed_elements": [
102+
"a",
103+
"abbr",
104+
"b",
105+
"blockquote",
106+
"br",
107+
"caption",
108+
"cite",
109+
"code",
110+
"dd",
111+
"del",
112+
"details",
113+
"dfn",
114+
"div",
115+
"dl",
116+
"dt",
117+
"em",
118+
"figcaption",
119+
"figure",
120+
"h1",
121+
"h2",
122+
"h3",
123+
"h4",
124+
"h5",
125+
"h6",
126+
"hr",
127+
"i",
128+
"img",
129+
"ins",
130+
"kbd",
131+
"li",
132+
"mark",
133+
"ol",
134+
"p",
135+
"picture",
136+
"pre",
137+
"q",
138+
"s",
139+
"samp",
140+
"small",
141+
"span",
142+
"strong",
143+
"sub",
144+
"summary",
145+
"sup",
146+
"table",
147+
"tbody",
148+
"td",
149+
"tfoot",
150+
"th",
151+
"thead",
152+
"time",
153+
"tr",
154+
"tt",
155+
"ul",
156+
"var",
157+
"wbr"
158+
]
159+
}
160+
}

0 commit comments

Comments
 (0)