forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Fix markdown table alignments (mui#36136)
- Loading branch information
1 parent
718d377
commit a18006a
Showing
12 changed files
with
62 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function attr(attrs) { | ||
return (attrs || []).reduce((acc, item) => ({ ...acc, [item[0]]: item[1] }), {}); | ||
} | ||
|
||
module.exports = { | ||
names: ['tableAlignment'], | ||
description: 'Set table alignment.', | ||
tags: ['table'], | ||
function: (params, onError) => { | ||
params.tokens.forEach((token) => { | ||
// This is wrong: | ||
// | Version | Supported | | ||
// | ------- | ------------------ | | ||
// | ||
// The second column should be left aligned because it contains text: | ||
// | Version | Supported | | ||
// | ------- | :----------------- | | ||
// | ||
// However, columns that includes numbers should be right aligned: | ||
// | Version | Supported | | ||
// | ------: | :----------------- | | ||
// | ||
// More details: https://ux.stackexchange.com/questions/24066/what-is-the-best-practice-for-data-table-cell-content-alignment | ||
// | ||
// In this check we expect the style to be 'text-align:right' or equivalent. | ||
if (token.type === 'th_open' && attr(token.attrs).style == null) { | ||
onError({ | ||
lineNumber: token.lineNumber, | ||
detail: `${params.lines[token.lineNumber - 1]}`, | ||
}); | ||
} | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters