Skip to content

Commit 99d1dd6

Browse files
authored
feat(markdown-transform): add table transforms (#507)
Signed-off-by: TC5022 <[email protected]>
1 parent ac06acd commit 99d1dd6

26 files changed

+2358
-4
lines changed

packages/markdown-common/lib/CommonMarkUtils.js

+10
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ function mkATXHeading(level) {
173173
return Array(level).fill('#').join('');
174174
}
175175

176+
/**
177+
* Create table heading
178+
* @param {number} col - the number of columns
179+
* @return {string} the markup for the table heading
180+
*/
181+
function mkTableHeading(col) {
182+
return Array(col).fill('|---------').join('') + '|';
183+
}
184+
176185
/**
177186
* Adding escapes for text nodes
178187
* @param {string} input - unescaped
@@ -334,6 +343,7 @@ module.exports.mkNewLine = mkNewLine;
334343
module.exports.mkPrefix = mkPrefix;
335344
module.exports.mkSetextHeading = mkSetextHeading;
336345
module.exports.mkATXHeading = mkATXHeading;
346+
module.exports.mkTableHeading = mkTableHeading;
337347

338348
module.exports.escapeText = escapeText;
339349
module.exports.escapeCodeBlock = escapeCodeBlock;

0 commit comments

Comments
 (0)