mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-27 01:51:34 +08:00
Replace newlines inside table cells so that resulting markdown is valid
This commit is contained in:
parent
0f64fe53cb
commit
7af39b57f0
@ -6,6 +6,7 @@ This is a fork of the original [turndown-plugin-gfm](https://github.com/domchris
|
|||||||
|
|
||||||
- Always render tables even they don't have a header.
|
- Always render tables even 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.
|
- 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.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
3
publish.sh
Normal file
3
publish.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
npm version patch
|
||||||
|
npm publish
|
||||||
@ -99,7 +99,7 @@ function cell (content, node) {
|
|||||||
var index = indexOf.call(node.parentNode.childNodes, node)
|
var index = indexOf.call(node.parentNode.childNodes, node)
|
||||||
var prefix = ' '
|
var prefix = ' '
|
||||||
if (index === 0) prefix = '| '
|
if (index === 0) prefix = '| '
|
||||||
return prefix + content + ' |'
|
return prefix + content.trim().replace(/[\n\r]/g, "<br>") + ' |'
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeContainsTable(node) {
|
function nodeContainsTable(node) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user