mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-27 06:52:27 +08:00
Make table cells at least 3 char long
This commit is contained in:
parent
90cff86ac0
commit
36179a8394
@ -7,6 +7,7 @@ This is a fork of the original [turndown-plugin-gfm](https://github.com/domchris
|
||||
- Always render tables even if they don't have a header.
|
||||
- Don't render the border of tables that contain other tables (frequent for websites that do the layout using tables). Only render the inner tables, if any, and if they also don't contain other tables.
|
||||
- Replace newlines (`\n`) with `<br>` inside table cells so that multi-line content is displayed correctly as Markdown.
|
||||
- Table cells are at least three characters long (padded with spaces) so that they render correctly in GFM-compliant renderers.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -99,7 +99,9 @@ function cell (content, node) {
|
||||
var index = indexOf.call(node.parentNode.childNodes, node)
|
||||
var prefix = ' '
|
||||
if (index === 0) prefix = '| '
|
||||
return prefix + content.trim().replace(/[\n\r]/g, "<br>") + ' |'
|
||||
let filteredContent = content.trim().replace(/[\n\r]/g, "<br>");
|
||||
while (filteredContent.length < 3) filteredContent += ' ';
|
||||
return prefix + filteredContent + ' |'
|
||||
}
|
||||
|
||||
function nodeContainsTable(node) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user