-
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.
feat: 1.支持emmet模式(目前输入t+Tab可以生成todo 输入tm*n可以生成m*n的表格)
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export function generateMarkdownTable(row, col) { | ||
// Initialize table header | ||
let tableHeader = '|'; | ||
for (let i = 1; i <= col; i++) { | ||
tableHeader += ` ${i} |`; | ||
} | ||
|
||
// Initialize separator | ||
let separator = '|'; | ||
for (let i = 1; i <= col; i++) { | ||
separator += '---|'; | ||
} | ||
|
||
// Initialize table content | ||
let tableContent = ''; | ||
for (let i = 1; i <= row; i++) { | ||
let rowContent = '|'; | ||
for (let j = 1; j <= col; j++) { | ||
rowContent += ` ${i}-${j} |`; | ||
} | ||
tableContent += `${rowContent}\n`; | ||
} | ||
|
||
// Combine header, separator, and content to form the Markdown table | ||
return `${tableHeader}\n${separator}\n${tableContent}`; | ||
} |