Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Block Formmatting(Markdown default) does not include newline char #11

Open
juliosueiras opened this issue Jul 10, 2015 · 4 comments

Comments

@juliosueiras
Copy link
Contributor

Before

2015-07-10-124838_1366x768_scrot

After

2015-07-10-125033_1366x768_scrot

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

@juliosueiras
Copy link
Contributor Author

Padding issues is mostly because of maxWidth of message

@RodrigoEspinosa
Copy link
Owner

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.

@juliosueiras
Copy link
Contributor Author

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

@juliosueiras
Copy link
Contributor Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants