summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2019-01-29 20:33:28 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-01-29 20:33:28 +0900
commitb0e00da2f713540c4fa2e6156b9e67e6e9a3739a (patch)
tree0872d4f77c7ad3cec447bdcc5eb55312cf7b4549
parentリプライ/メンションされていれば非フォロワーへのフォ... (diff)
downloadmisskey-b0e00da2f713540c4fa2e6156b9e67e6e9a3739a.tar.gz
misskey-b0e00da2f713540c4fa2e6156b9e67e6e9a3739a.tar.bz2
misskey-b0e00da2f713540c4fa2e6156b9e67e6e9a3739a.zip
Fix #4034 (#4037)
* Fix #4034 * improve
-rw-r--r--src/mfm/html.ts2
-rw-r--r--test/mfm.ts6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/mfm/html.ts b/src/mfm/html.ts
index 6dba6defe3..61d2d7b5af 100644
--- a/src/mfm/html.ts
+++ b/src/mfm/html.ts
@@ -157,7 +157,7 @@ export default (tokens: MfmForest, mentionedRemoteUsers: INote['mentionedRemoteU
text(token) {
const el = doc.createElement('span');
- const nodes = (token.node.props.text as string).split('\n').map(x => doc.createTextNode(x));
+ const nodes = (token.node.props.text as string).split(/\r\n|\r|\n/).map(x => doc.createTextNode(x));
for (const x of intersperse('br', nodes)) {
el.appendChild(x === 'br' ? doc.createElement('br') : x);
diff --git a/test/mfm.ts b/test/mfm.ts
index a1f83fe1db..3452c5f109 100644
--- a/test/mfm.ts
+++ b/test/mfm.ts
@@ -1096,6 +1096,12 @@ describe('MFM', () => {
const output = '<p><span>foo<br>bar<br>baz</span></p>';
assert.equal(toHtml(analyze(input)), output);
});
+
+ it('br alt', () => {
+ const input = 'foo\r\nbar\rbaz';
+ const output = '<p><span>foo<br>bar<br>baz</span></p>';
+ assert.equal(toHtml(analyze(input)), output);
+ });
});
it('code block with quote', () => {