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

blank line to separate paragraph it dose not work #137

Closed
simrb opened this issue Jun 24, 2014 · 4 comments
Closed

blank line to separate paragraph it dose not work #137

simrb opened this issue Jun 24, 2014 · 4 comments
Assignees
Labels

Comments

@simrb
Copy link

simrb commented Jun 24, 2014

my code

require 'kramdown'
str = "this is first line \n\r this is third line"
Kramdown::Document.new(str).to_html

that outputs the below

<p>this is first line 
 this is third line</p>

obviously, that is not what i want to be , i want the \n or \r to be the <br/>,
so, would i miss something ?

@gettalong gettalong self-assigned this Jun 24, 2014
@gettalong
Copy link
Owner

Line breaks in Markdown/kramdown are not treated as hard line breaks but as line continuations. If you need to separate two paragraphs, use a blank line.

If you want to insert a <br /> tag, use two spaces at the end of a line. See http://kramdown.gettalong.org/syntax.html for more information.

@simrb
Copy link
Author

simrb commented Jun 25, 2014

Thanks, @gettalong

I were aware of that document before i ask question,
but it is awkward to this situation of what i edit is not what i see.
I am very hope to add this feature.

@gettalong
Copy link
Owner

I don't understand your problem. The example you have given is the following:

this is first line
 this is third line

So there is clearly no blank line between the two lines. You need to enter the following:

this is first line

 this is third line

There is now a blank line between the two lines and therefore this will produce two separate paragraphs.

If you want to have line breaks (<br />), you need to use two spaces or two backslashes at the end of a line:

this is a  
test for line breaks\\ 
in a paragraph

will produce

<p>this is a<br />
test for line breaks<br />
in a paragraph</p>

@simrb
Copy link
Author

simrb commented Jun 25, 2014

Ok, the problem i solved it , i forget setting the css of paragraph to make it looks like having a blank line with p { padding-bottom: 5px;} instead of inserting a blank line in editor as separator.

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

2 participants