remark-lint/packages/remark-lint-no-heading-content-indent/readme.md

149 lines
2.4 KiB
Markdown
Raw Normal View History

<!--This file is generated-->
# remark-lint-no-heading-content-indent
2019-06-20 11:51:46 +03:00
Warn when content of headings is indented.
## Fix
2017-12-08 17:39:26 +03:00
[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify)
2019-06-20 11:51:46 +03:00
removes all unneeded padding around content in headings.
2019-06-20 11:51:46 +03:00
See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
on how to automatically fix warnings for this rule.
## Presets
This rule is included in the following presets:
| Preset | Setting |
| ------ | ------- |
2017-12-08 17:39:26 +03:00
| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | |
## Example
##### `valid.md`
###### In
Note: `·` represents a space.
```markdown
#·Foo
## Bar·##
##·Baz
Setext headings are not affected.
Baz
===
```
###### Out
No messages.
##### `invalid.md`
###### In
Note: `·` represents a space.
```markdown
#··Foo
## Bar··##
##··Baz
```
###### Out
```text
1:4: Remove 1 space before this headings content
3:7: Remove 1 space after this headings content
5:7: Remove 1 space before this headings content
```
##### `empty-heading.md`
###### In
Note: `·` represents a space.
```markdown
#··
```
###### Out
No messages.
##### `tight.md`
###### In
Note: `·` represents a space.
```markdown
In pedantic mode, headings without spacing can also be detected:
##No spacing left, too much right··##
```
###### Out
```text
3:3: Add 1 space before this headings content
3:34: Remove 1 space after this headings content
```
## Install
```sh
npm install remark-lint-no-heading-content-indent
```
## Usage
You probably want to use it on the CLI through a config file:
```diff
...
"remarkConfig": {
"plugins": [
...
"lint",
+ "lint-no-heading-content-indent",
...
]
}
...
```
Or use it on the CLI directly
```sh
remark -u lint -u lint-no-heading-content-indent readme.md
```
Or use this on the API:
```diff
var remark = require('remark');
var report = require('vfile-reporter');
remark()
.use(require('remark-lint'))
+ .use(require('remark-lint-no-heading-content-indent'))
.process('_Emphasis_ and **importance**', function (err, file) {
console.error(report(err || file));
});
```
## License
2018-11-22 14:18:12 +03:00
[MIT](https://github.com/remarkjs/remark-lint/blob/master/license) © [Titus Wormer](https://wooorm.com)