Skip to content

Commit f12108d

Browse files
committed
Support break line
1 parent 4e033dc commit f12108d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tables.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ function cell (content, node) {
7676
var prefix = ' '
7777
if (index === 0) prefix = '| '
7878
// Ensure single line per cell (both windows and unix EoL)
79-
// TODO: allow gfm non-strict mode to replace new lines by `<br/>`
80-
content = content.replace(/\r\n/g, '\n').replace(/\n/g, ' ')
79+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
80+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
8181
// | must be escaped as \|
8282
content = content.replace(/\|/g, '\\|')
8383
return prefix + content + ' |'

0 commit comments

Comments
 (0)