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

Line breaks in code blocks #72

Closed
nstahl opened this issue Jun 8, 2017 · 8 comments
Closed

Line breaks in code blocks #72

nstahl opened this issue Jun 8, 2017 · 8 comments
Labels

Comments

@nstahl
Copy link

nstahl commented Jun 8, 2017

Hello,

I would expect line breaks to be parsed in code blocks.

For example, the markdown

```javascript
var x = 1;
var y = 2;
```
should render, much like it does on Github, as

var x = 1;
var y = 2;

Instead, markdownx renders it as

var x = 1; var y = 2;

Is that intentional or am I missing something?

Thank you for building markdownx!
-- Niko

@xenatisch
Copy link
Collaborator

xenatisch commented Jun 11, 2017

It is not caused by MarkdownX. Rather, it is the Markdown interpreter you are using that's causing it (as I see it).

Here is an example of what you wanna do in practice:

screen shot 2017-06-11 at 11 08 46

@xenatisch
Copy link
Collaborator

How did it go? Let me know if you can't figure out to solve the problem.

@nstahl
Copy link
Author

nstahl commented Jun 15, 2017

Hi @xenatisch -- thanks for your quick response!

I'm not quite sure how to set a Markdown interpreter that can fix this. Can you advise? I'm trying to replicate the functionality that github has for rendering .md files.

Thanks!

@xenatisch
Copy link
Collaborator

Have you followed the documentations, particularly the details on Markdowify function?

@nstahl
Copy link
Author

nstahl commented Jul 9, 2017

Thanks @xenatisch. Your answers were very helpful. I ended up using Github's API for my use case – it adds all the css needed for code formatting.

@xenatisch
Copy link
Collaborator

Excellent. Maybe we can suggest the API somewhere in our tutorials so others can also benefit from it. You're welcome to submit it as a contribution if you so wish.

All the best with your project.

@djcroissant
Copy link

djcroissant commented Jun 27, 2018

I had the same issue where line breaks were not rendering correctly in code blocks. I found the issue only occurs when using the backtick notation.

Markdown:

>```
>line 1
>line 2
>```

Renders as:

line 1 line 2

However, using the indent notation works.

Markdown:

>    line 1
>    line 2

Renders as:

line 1
line 2

This behavior is inconsistent with other Markdown rendering tools. But the work-around is easy if you know what to expect.

@vishvanath45
Copy link

Have you followed the documentations, particularly the details on Markdowify function?

@xenatisch Hi, I am facing the same error in code formatting, the Markdownify function that you mentioned seems to be dead link, can you suggest me how to solve this issue.

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

No branches or pull requests

4 participants