Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 2b4a36d

Browse files
committed
Add helper script for Markdown listing.
1 parent 9058389 commit 2b4a36d

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2.4.4
2+
- Adds markdown linting
13
2.4.3
24
- Add eslint rule + doc entry regarding trailing commas
35
2.4.2

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ Our Client Services team's [CSS Style Guide](/css/Readme.md). Written with a lot
3636

3737
See the `python` directory of this repo for a standardized `pylintrc` file and
3838
instructions on using `pep8`, `pylint` and `pyflakes` to check Python code.
39+
40+
## Documentation
41+
42+
See the [`docs`](docs) directory for setup and configuration of Markdown linting.

bin/lint-md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -eu
2+
# Lint markdown files using Mobify's .remarkrc configuration.
3+
4+
# FIXME: Brittle :|
5+
BIN_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
6+
CODE_STYLE_DIR="$BIN_DIR/../mobify-code-style"
7+
REMARK_RC="$CODE_STYLE_DIR/.remarkrc"
8+
REMARK_CLI="$CODE_STYLE_DIR/node_modules/.bin/remark"
9+
10+
$REMARK_CLI --rc-path $REMARK_RC "$@"

docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
> Write great documentation! – * [_Mobify Developer Values_](https://github.com/mobify/developer-values#️-write-great-documentation)
2+
3+
At Mobify, documentation is written in markdown.
4+
5+
Documentation should live as close as possible to the code it documents.
6+
Typically, this means including it in a `docs` folder at the root of the repo.
7+
Customer facing documentation should be published to a sub path of
8+
docs.mobify.com.
9+
10+
To make writing document easier, we provide:
11+
12+
* A linter for consistent markdown style.
13+
* A writing checklist for consistent process.
14+
15+
### Markdown Linting
16+
17+
```bash
18+
npm install --save mobify-code-style
19+
20+
# 🏃 the linter markdown files in the `docs` folder:
21+
./node_modules/.bin/lint-md docs
22+
23+
# Arguments are passed to `remark-cli`: https://github.com/wooorm/remark/tree/master/packages/remark-cli
24+
./node_modules/.bin/lint-md --watch docs
25+
26+
# Try to automajically fix linting warnings:
27+
./node_modules/.bin/lint-md --output docs
28+
```
29+
130
### Writing Checklist
231

332
**Before you start writing**

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"bugs": {
1212
"url": "https://github.com/mobify/mobify-code-style/issues"
1313
},
14+
"bin": {
15+
"lint-md": "./bin/lint-md"
16+
},
1417
"homepage": "https://github.com/mobify/mobify-code-style",
1518
"scripts": {
1619
"test": "bash docs/test/test.sh"
@@ -20,4 +23,4 @@
2023
"remark-lint": "5.0.1",
2124
"remark-preset-lint-recommended": "1.0.0"
2225
}
23-
}
26+
}

0 commit comments

Comments
 (0)