Package Exports
- remark-lint-table-cell-padding
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-lint-table-cell-padding) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
remark-lint-table-cell-padding
Warn when table cells are incorrectly padded.
Options: 'consistent'
, 'padded'
, or 'compact'
, default: 'consistent'
.
'consistent'
detects the first used cell padding style and warns when
subsequent cells use different styles.
Fix
remark-stringify
formats tables with padding by default.
Pass
spacedTable: false
to not use padding.
See 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 |
---|---|
remark-preset-lint-consistent |
'consistent' |
remark-preset-lint-markdown-style-guide |
'padded' |
Example
ok.md
When configured with 'padded'
.
In
Note: this example uses GFM.
| A | B |
| ----- | ----- |
| Alpha | Bravo |
Out
No messages.
not-ok.md
When configured with 'padded'
.
In
Note: this example uses GFM.
| A | B |
| :----|----: |
| Alpha|Bravo |
| C | D |
| :----- | ---: |
|Charlie | Delta|
Too much padding isn’t good either:
| E | F | G | H |
| :---- | -------- | :----: | -----: |
| Echo | Foxtrot | Golf | Hotel |
Out
3:8: Cell should be padded
3:9: Cell should be padded
7:2: Cell should be padded
7:17: Cell should be padded
13:9: Cell should be padded with 1 space, not 2
13:20: Cell should be padded with 1 space, not 2
13:21: Cell should be padded with 1 space, not 2
13:29: Cell should be padded with 1 space, not 2
13:30: Cell should be padded with 1 space, not 2
empty.md
When configured with 'padded'
.
In
Note: this example uses GFM.
<!-- Empty cells are OK, but those surrounding them may not be. -->
| | Alpha | Bravo|
| ------ | ----- | ---: |
| Charlie| | Echo|
Out
3:25: Cell should be padded
5:10: Cell should be padded
5:25: Cell should be padded
missing-body.md
When configured with 'padded'
.
In
Note: this example uses GFM.
<!-- Missing cells are fine as well. -->
| Alpha | Bravo | Charlie |
| ----- | ------- | ------- |
| Delta |
| Echo | Foxtrot |
Out
No messages.
ok.md
When configured with 'compact'
.
In
Note: this example uses GFM.
|A |B |
|-----|-----|
|Alpha|Bravo|
Out
No messages.
not-ok.md
When configured with 'compact'
.
In
Note: this example uses GFM.
| A | B |
| -----| -----|
| Alpha| Bravo|
|C | D|
|:------|-----:|
|Charlie|Delta |
Out
3:2: Cell should be compact
3:11: Cell should be compact
7:16: Cell should be compact
ok-padded.md
When configured with 'consistent'
.
In
Note: this example uses GFM.
| A | B |
| ----- | ----- |
| Alpha | Bravo |
| C | D |
| ------- | ----- |
| Charlie | Delta |
Out
No messages.
not-ok-padded.md
When configured with 'consistent'
.
In
Note: this example uses GFM.
| A | B |
| ----- | ----- |
| Alpha | Bravo |
| C | D |
| :----- | ----: |
|Charlie | Delta |
Out
7:2: Cell should be padded
ok-compact.md
When configured with 'consistent'
.
In
Note: this example uses GFM.
|A |B |
|-----|-----|
|Alpha|Bravo|
|C |D |
|-------|-----|
|Charlie|Delta|
Out
No messages.
not-ok-compact.md
When configured with 'consistent'
.
In
Note: this example uses GFM.
|A |B |
|-----|-----|
|Alpha|Bravo|
|C | D|
|:------|-----:|
|Charlie|Delta |
Out
7:16: Cell should be compact
not-ok.md
When configured with '💩'
.
Out
1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'`
Install
This package is ESM only:
Node 12+ is needed to use it and it must be imported
ed instead of required
d.
npm:
npm install remark-lint-table-cell-padding
This package exports no identifiers.
The default export is remarkLintTableCellPadding
.
Use
You probably want to use it on the CLI through a config file:
…
"remarkConfig": {
"plugins": [
…
"lint",
+ "lint-table-cell-padding",
…
]
}
…
Or use it on the CLI directly
remark -u lint -u lint-table-cell-padding readme.md
Or use this on the API:
import {remark} from 'remark'
import {reporter} from 'vfile-reporter'
import remarkLint from 'remark-lint'
import remarkLintTableCellPadding from 'remark-lint-table-cell-padding'
remark()
.use(remarkLint)
+ .use(remarkLintTableCellPadding)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})
Contribute
See contributing.md
in remarkjs/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.