Add rule MD055/table-missing-border (fixes #93, refs #1039, no generated files).

This commit is contained in:
Gabriel Kuznik 2023-12-01 12:33:48 +01:00 committed by David Anson
parent 4a52864b39
commit a563c082a5
11 changed files with 228 additions and 12 deletions

View file

@ -105,6 +105,10 @@ Strong **with** different style {MD050}
<!-- markdownlint-disable-next-line MD053 -->
[url]: https://example.com/page
| table | header |
|--------|--------|
{MD055} | cell |
<!-- markdownlint-configure-file {
"required-headings": {
"headings": [

View file

@ -51,3 +51,7 @@
| cell | <!-- \
| cell | `{MD038} ` --> |
| cell | cell |
<!-- markdownlint-configure-file {
"table-missing-border": false
} -->

View file

@ -29,7 +29,6 @@ This is a short line.
| Content Cell | Content Cell | Content Cell | Content Cell | Content Cell | Content Cell |
| ============== | ============== | ============== | ============== | ============== | ============== |
| Footer Cell | Footer Cell | Footer Cell | Footer Cell | Footer Cell | Footer Cell |
{: rules="groups"}
This is a very very very very very very very very very very very very very very very very very very very very long line. {MD013}
@ -44,7 +43,6 @@ Another line.
| Content Cell | Content Cell | Content Cell | Content Cell | Content Cell | Content Cell |
| ============== | ============== | ============== | ============== | ============== | ============== |
| Footer Cell | Footer Cell | Footer Cell | Footer Cell | Footer Cell | Footer Cell |
{: rules="groups"}
<!-- markdownlint-configure-file {
"line-length": {

View file

@ -83,7 +83,7 @@ test("projectFiles", (t) => {
"schema/*.md"
]))
.then((files) => {
t.is(files.length, 58);
t.is(files.length, 59);
const options = {
files,
"config": require("../.markdownlint.json")
@ -476,13 +476,14 @@ test("styleAll", (t) => new Promise((resolve) => {
"MD042": [ 81 ],
"MD045": [ 85 ],
"MD046": [ 49, 73, 77 ],
"MD047": [ 126 ],
"MD047": [ 130 ],
"MD048": [ 77 ],
"MD049": [ 90 ],
"MD050": [ 94 ],
"MD051": [ 96 ],
"MD052": [ 98 ],
"MD053": [ 100 ]
"MD053": [ 100 ],
"MD055": [ 110 ]
}
};
// @ts-ignore
@ -525,13 +526,14 @@ test("styleRelaxed", (t) => new Promise((resolve) => {
"MD042": [ 81 ],
"MD045": [ 85 ],
"MD046": [ 49, 73, 77 ],
"MD047": [ 126 ],
"MD047": [ 130 ],
"MD048": [ 77 ],
"MD049": [ 90 ],
"MD050": [ 94 ],
"MD051": [ 96 ],
"MD052": [ 98 ],
"MD053": [ 100 ]
"MD053": [ 100 ],
"MD055": [ 110 ]
}
};
// @ts-ignore
@ -841,7 +843,7 @@ test("customFileSystemAsync", (t) => new Promise((resolve) => {
}));
test("readme", async(t) => {
t.plan(121);
t.plan(124);
const tagToRules = {};
for (const rule of rules) {
for (const tag of rule.tags) {
@ -916,7 +918,7 @@ test("readme", async(t) => {
});
test("validateJsonUsingConfigSchemaStrict", async(t) => {
t.plan(171);
t.plan(173);
// @ts-ignore
const ajv = new Ajv(ajvOptions);
const validateSchemaStrict = ajv.compile(configSchemaStrict);
@ -1036,7 +1038,7 @@ test("validateConfigExampleJson", async(t) => {
});
test("allBuiltInRulesHaveValidUrl", (t) => {
t.plan(144);
t.plan(147);
for (const rule of rules) {
// @ts-ignore
t.truthy(rule.information);

View file

@ -9,3 +9,7 @@ Head | Head
<br/> | {MD033}
text | text
{MD033} | <b>text</b>
<!-- markdownlint-configure-file {
"table-missing-border": false
} -->

140
test/table-missing-pipes.md Normal file
View file

@ -0,0 +1,140 @@
# Table Missing Pipes
## Bad Header Row
| Table | {MD055}
|-------|---------|
Table | {MD055} |
|-------|---------|
Table | {MD055}
|-------|---------|
## Bad Separator Row
| Table | Header |
|-------|---------
{MD055:17}
| Table | Header |
-------|--------|
{MD055:22}
| Table | Header |
-------|--------
{MD055:27}
## Missing everything
{MD055} | Header
---------|-------
{MD055} | cell
{MD055:34}
{MD055} | Header
--------:|:-----:
{MD055} | cell
{MD055:40}
## Missing trailing pipe
| Table | Header |
|--------:|:-------|
| {MD055} | cell
| Table | Header |
|---------|--------|
| {MD055} | cell
| cell | cell |
| cell | cell |
| Table | Header |
|---------|--------|
| cell | cell |
| {MD055} | cell
| cell | cell |
| Table | Header |
|---------|--------|
| cell | cell |
| cell | cell |
| {MD055} | cell
## Missing leading pipe
| Table | Header |
|-------:|:-------|
{MD055} | cell |
| Table | Header |
|--------|--------|
{MD055} | cell |
| cell | cell |
| cell | cell |
| Table | Header |
|--------|--------|
| cell | cell |
{MD055} | cell |
| cell | cell |
| Table | Header |
|--------|--------|
| cell | cell |
| cell | cell |
{MD055} | cell |
## Missing both sides
| Table | Header |
|-------:|:-------|
{MD055} | cell
| Table | Header |
|--------|--------|
{MD055} | cell
| cell | cell |
| cell | cell |
| Table | Header |
|--------|--------|
| cell | cell |
{MD055} | cell
| cell | cell |
| Table | Header |
|--------|--------|
| cell | cell |
| cell | cell |
{MD055} | cell
## No false-positive
| Table | Header |
|-------|--------|
| cell | cell |
| Table | Header |
|-------|--------|
| cell | cell |
| cell | cell |
| cell | cell |
## No trailing blank line
| Table | Header |
|-------|--------|
| cell | cell |
{MD055} Text
## Markdown Combination
> | Table | Header |
> |-------|--------|
> -{MD055}| cell |