Skip to content

Commit c60b819

Browse files
🩹 [Patch]: Add Markdown and PowerShell style guidelines for consistency across documentation and scripts
1 parent aca4162 commit c60b819

File tree

2 files changed

+1115
-0
lines changed

2 files changed

+1115
-0
lines changed
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
---
2+
applyTo: '**/*.md'
3+
description: Markdown style guidelines for consistency across documentation.
4+
---
5+
6+
# Markdown Style Guidelines
7+
8+
This document defines the markdown style guidelines for all markdown files in this repository. These rules follow common markdown linter best practices and ensure consistency across documentation.
9+
10+
## Headings
11+
12+
- Use ATX-style headings (`#`) instead of Setext-style (underlines)
13+
- Include a space after the hash marks: `# Heading` not `#Heading`
14+
- Use only one top-level heading (`#`) per document
15+
- Do not skip heading levels (e.g., don't go from `#` to `###`)
16+
- Surround headings with blank lines (one before, one after, excluding the first heading in the document unless preceded by frontmatter)
17+
- Do not use trailing punctuation in headings (no periods, colons, etc.)
18+
- Use sentence case for headings unless referring to proper nouns or code identifiers
19+
20+
**Good:**
21+
22+
```markdown
23+
# Main heading
24+
25+
## Subsection
26+
27+
### Details
28+
```
29+
30+
**Bad:**
31+
32+
```markdown
33+
#No space after hash
34+
### Skipped level 2
35+
## Heading with period.
36+
```
37+
38+
## Lists
39+
40+
- Use consistent list markers throughout the document (`-` for unordered, `1.` for ordered)
41+
- Do not add blank lines between list items (unless item contains multiple paragraphs)
42+
- Indent nested lists by 2 spaces for unordered, 3 spaces for ordered
43+
- Use `1.` for all ordered list items (auto-numbering) or number them sequentially
44+
- Surround lists with blank lines (one before, one after)
45+
- Use `-` for unordered lists (not `*` or `+`)
46+
47+
**Good:**
48+
49+
```markdown
50+
Here is a list:
51+
52+
- First item
53+
- Second item
54+
- Third item
55+
56+
Another list:
57+
58+
1. First step
59+
1. Second step
60+
1. Third step
61+
```
62+
63+
**Bad:**
64+
65+
```markdown
66+
No blank line before list:
67+
- Item one
68+
69+
- Blank lines between items
70+
- Not needed
71+
72+
* Wrong marker
73+
+ Mixed markers
74+
```
75+
76+
## Code Blocks
77+
78+
- Always use fenced code blocks (triple backticks) with language identifiers
79+
- Always include a blank line before and after code blocks
80+
- Specify the language for syntax highlighting (`bash`, `python`, `markdown`, `json`, etc.)
81+
- Use `plaintext` or `text` if no specific language applies
82+
- Indent code blocks at the same level as surrounding content
83+
84+
**Good:**
85+
86+
```markdown
87+
Here is an example:
88+
89+
\`\`\`bash
90+
echo "Hello, world!"
91+
\`\`\`
92+
93+
The command prints a message.
94+
```
95+
96+
**Bad:**
97+
98+
```markdown
99+
No language identifier:
100+
\`\`\`
101+
code here
102+
\`\`\`
103+
No blank lines before/after code blocks.
104+
```
105+
106+
## Links
107+
108+
- Use reference-style links for repeated URLs
109+
- Use relative paths for internal links (relative to the current file)
110+
- Always provide link text in square brackets: `[text](url)`
111+
- Do not use bare URLs (wrap them: `<https://example.com>`)
112+
- For internal repository links, use relative paths starting with `./` or `../`
113+
- Use `.md` extension for links to markdown files
114+
115+
**Good:**
116+
117+
```markdown
118+
See the [installation guide](../docs/installation.md) for details.
119+
120+
Check out [GitHub][gh] and [GitLab][gl] for hosting.
121+
122+
[gh]: https://github.com
123+
[gl]: https://gitlab.com
124+
```
125+
126+
**Bad:**
127+
128+
```markdown
129+
Absolute path: [guide](/docs/installation.md)
130+
Missing extension: [guide](../docs/installation)
131+
Bare URL: Visit https://example.com
132+
```
133+
134+
## Tables
135+
136+
- Use tables when content follows a consistent structure (instead of lists)
137+
- Align columns using hyphens for readability
138+
- Include header row separator with at least 3 hyphens per column
139+
- Surround tables with blank lines (one before, one after)
140+
- Use pipes (`|`) to separate columns
141+
- Align content within columns for readability (optional but recommended)
142+
143+
**Good:**
144+
145+
```markdown
146+
Here is a comparison:
147+
148+
| Feature | Supported | Notes |
149+
|---------|-----------|-------|
150+
| Feature A | Yes | Fully supported |
151+
| Feature B | No | Planned for v2 |
152+
| Feature C | Partial | Beta feature |
153+
154+
The table shows current status.
155+
```
156+
157+
**Bad:**
158+
159+
```markdown
160+
Using list when table is better:
161+
- Feature A: Yes - Fully supported
162+
- Feature B: No - Planned for v2
163+
- Feature C: Partial - Beta feature
164+
```
165+
166+
## Emphasis
167+
168+
- Use `*` or `_` for emphasis (italic), `**` or `__` for strong emphasis (bold)
169+
- Be consistent within a document (prefer `*` and `**`)
170+
- Do not use emphasis for headings
171+
- Use backticks for code/technical terms, not emphasis
172+
173+
**Good:**
174+
175+
```markdown
176+
This is *emphasized* text.
177+
This is **strong** text.
178+
Use the `--verbose` flag for details.
179+
```
180+
181+
**Bad:**
182+
183+
```markdown
184+
This is _emphasized_ text with **strong** mixed styles.
185+
Use the *--verbose* flag (should be backticks).
186+
```
187+
188+
## Line Length
189+
190+
- Wrap prose at 80-120 characters per line
191+
- Do not wrap code blocks, tables, or URLs
192+
- Break after sentences or at natural phrase boundaries
193+
- Empty lines do not count toward line length
194+
195+
## Whitespace
196+
197+
- Use a single blank line to separate blocks of content
198+
- Do not use multiple consecutive blank lines
199+
- End files with a single newline character
200+
- Do not use trailing whitespace at the end of lines
201+
- Use spaces (not tabs) for indentation
202+
203+
## Other Rules
204+
205+
### Horizontal Rules
206+
207+
- Use three hyphens (`---`) for horizontal rules
208+
- Surround horizontal rules with blank lines
209+
210+
**Good:**
211+
212+
```markdown
213+
Section one content.
214+
215+
---
216+
217+
Section two content.
218+
```
219+
220+
### Blockquotes
221+
222+
- Use `>` for blockquotes with a space after
223+
- Surround blockquotes with blank lines
224+
- Use multiple `>` for nested quotes
225+
226+
**Good:**
227+
228+
```markdown
229+
As the docs state:
230+
231+
> This is an important note.
232+
> It spans multiple lines.
233+
234+
Back to regular text.
235+
```
236+
237+
### Images
238+
239+
- Use alt text for all images: `![alt text](path/to/image.png)`
240+
- Use relative paths for repository images
241+
- Prefer reference-style for repeated images
242+
243+
**Good:**
244+
245+
```markdown
246+
![Architecture diagram](../media/architecture.png)
247+
248+
See the [logo][logo-img] above.
249+
250+
[logo-img]: ./images/logo.png
251+
```
252+
253+
### HTML
254+
255+
- Avoid HTML in markdown when possible
256+
- Use HTML only for features not supported by markdown
257+
- Close all HTML tags properly
258+
259+
### File Names
260+
261+
- Use lowercase for markdown file names
262+
- Use hyphens (`-`) not underscores (`_`) to separate words
263+
- Use `.md` extension (not `.markdown`)
264+
265+
**Examples:**
266+
267+
- `installation-guide.md`
268+
- `Installation_Guide.markdown`
269+
270+
## Linting
271+
272+
To validate markdown files against these guidelines, use a markdown linter such as:
273+
274+
- [markdownlint](https://github.com/DavidAnson/markdownlint)
275+
- [remark-lint](https://github.com/remarkjs/remark-lint)
276+
- [superlinter](https://github.com/super-linter/super-linter)
277+
278+
Configure the linter to enforce these rules in your CI/CD pipeline.

0 commit comments

Comments
 (0)