parent
2ed9e26a4f
commit
b0e00da2f7
|
@ -157,7 +157,7 @@ export default (tokens: MfmForest, mentionedRemoteUsers: INote['mentionedRemoteU
|
||||||
|
|
||||||
text(token) {
|
text(token) {
|
||||||
const el = doc.createElement('span');
|
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)) {
|
for (const x of intersperse('br', nodes)) {
|
||||||
el.appendChild(x === 'br' ? doc.createElement('br') : x);
|
el.appendChild(x === 'br' ? doc.createElement('br') : x);
|
||||||
|
|
|
@ -1096,6 +1096,12 @@ describe('MFM', () => {
|
||||||
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
||||||
assert.equal(toHtml(analyze(input)), output);
|
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', () => {
|
it('code block with quote', () => {
|
||||||
|
|
Loading…
Reference in New Issue