gitter-cli
gitter-cli copied to clipboard
Code Block Formmatting(Markdown default) does not include newline char
Before
After
The issue is located in marked.js which it does not insert newline character and cause the entire block to be oneline, is fixable by removing Renderer.prototype.code
though the padding is still incorrect, which result to be left of the screen
Padding issues is mostly because of maxWidth of message
One thought about the last comment, maybe we should replace the \n
in the comments for \n + Array(authorLength + 1).join(' ')
in the message code.
Okie, I am able to narrow down the problem
messageText = messageText.split('\n').map(function (line, index) {
// If is the first line, then leave it as it is.
console.log('line:' + line + ' index:' + index);
if (index < 1) {
return line;
}
// Append a number `authorLength` number of spaces before the line.
return Array(authorLength + 1).join(' ') + line;
}).join('\n');
this code is not correctly splitting newline
UPDATE
The culprit is actually
messageText = this.parseText(messageText, messageMaxWidth);
which it strip newline character (still checking if is marked is doing that or htmlToText)