Skip to content

Commit e3297e1

Browse files
committed
Remove prefix/suffix break line
1 parent b3813de commit e3297e1

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

dist/turndown-plugin-gfm.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ var TurndownPluginGfmService = (function (exports) {
114114
var prefix = ' ';
115115
if (index === 0) prefix = '| ';
116116
// Ensure single line per cell (both windows and unix EoL)
117-
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+/g, '<br />');
117+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
118+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
118119
// | must be escaped as \|
119120
content = content.replace(/\|/g, '\\|');
120121
return prefix + content + ' |'

lib/turndown-plugin-gfm.browser.cjs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ function cell (content, node) {
115115
var prefix = ' ';
116116
if (index === 0) prefix = '| ';
117117
// Ensure single line per cell (both windows and unix EoL)
118-
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+/g, '<br />');
118+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
119+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
119120
// | must be escaped as \|
120121
content = content.replace(/\|/g, '\\|');
121122
return prefix + content + ' |'

lib/turndown-plugin-gfm.browser.es.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ function cell (content, node) {
111111
var prefix = ' ';
112112
if (index === 0) prefix = '| ';
113113
// Ensure single line per cell (both windows and unix EoL)
114-
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+/g, '<br />');
114+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
115+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
115116
// | must be escaped as \|
116117
content = content.replace(/\|/g, '\\|');
117118
return prefix + content + ' |'

lib/turndown-plugin-gfm.cjs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ function cell (content, node) {
115115
var prefix = ' ';
116116
if (index === 0) prefix = '| ';
117117
// Ensure single line per cell (both windows and unix EoL)
118-
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+/g, '<br />');
118+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
119+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
119120
// | must be escaped as \|
120121
content = content.replace(/\|/g, '\\|');
121122
return prefix + content + ' |'

lib/turndown-plugin-gfm.es.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ function cell (content, node) {
111111
var prefix = ' ';
112112
if (index === 0) prefix = '| ';
113113
// Ensure single line per cell (both windows and unix EoL)
114-
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+/g, '<br />');
114+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
115+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
115116
// | must be escaped as \|
116117
content = content.replace(/\|/g, '\\|');
117118
return prefix + content + ' |'

src/tables.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +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-
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+/g, '<br />');
79+
// 先頭・末尾の改行は、不要なスペースが挿入されるだけなので削除している
80+
content = content.replace(/\r\n/g, '\n').replace(/^\n+/g, '').replace(/\n+$/g, '').replace(/\n+/g, '<br />');
8081
// | must be escaped as \|
8182
content = content.replace(/\|/g, '\\|')
8283
return prefix + content + ' |'

0 commit comments

Comments
 (0)