mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
Keep tables with no definitive heading row
This commit is contained in:
@@ -32,7 +32,12 @@ rules.tableRow = {
|
||||
}
|
||||
|
||||
rules.table = {
|
||||
filter: 'table',
|
||||
// Only convert tables with a heading row.
|
||||
// Tables with no heading row are kept using `keep` (see below).
|
||||
filter: function (node) {
|
||||
return node.nodeName === 'TABLE' && isHeadingRow(node.rows[0])
|
||||
},
|
||||
|
||||
replacement: function (content) {
|
||||
// Ensure there are no blank lines
|
||||
content = content.replace('\n\n', '\n')
|
||||
@@ -85,5 +90,8 @@ function cell (content, node) {
|
||||
}
|
||||
|
||||
export default function tables (turndownService) {
|
||||
turndownService.keep(function (node) {
|
||||
return node.nodeName === 'TABLE' && !isHeadingRow(node.rows[0])
|
||||
})
|
||||
for (var key in rules) turndownService.addRule(key, rules[key])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user