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

two blank lines break the code block #292

Open
ckcks12 opened this issue May 21, 2017 · 5 comments
Open

two blank lines break the code block #292

ckcks12 opened this issue May 21, 2017 · 5 comments

Comments

@ckcks12
Copy link

ckcks12 commented May 21, 2017

original text

function foo() {
    console.log(this);
}
// below two blank lines cause a bug


using markdown

markdown.toHTML('```\n\
function foo() {\n\
    console.log(this);\n\
}\n\
// below two blank lines cause a bug\n\
\n\
\n\
```')

converted

"<p><code></code>`
function foo() {
    console.log(this);
}
// below two blank lines cause a bug</p>

<p><code></code>`</p>"

Is that a bug or my mistake?

@ckcks12 ckcks12 changed the title two blank lines escape the code block two blank lines break the code block May 21, 2017
@ckcks12
Copy link
Author

ckcks12 commented May 21, 2017

not only trailing position but also anywhere the two blank lines exist the code block be broken ...

@nicecp
Copy link

nicecp commented Jul 16, 2017

I have meet the same issue, without line breaks in code

@clChenLiang
Copy link

I have try to revise the output of markdown.toHTML() function.
here the simple code:

    html.replace(/<code><\/code>\`(?=[^<])/g,'<code>');
    html.replace(/<code><\/code>\`(?=<)/g, '<\/code>');

@ckcks12
Copy link
Author

ckcks12 commented Mar 28, 2018

Of course there are more workarounds for this but we want it be fixed, not more cheats.

@icarito
Copy link

icarito commented May 12, 2018

Perhaps we could start by writing a test that fails... I'll try to get to it. I share your pain - Tiddlywiki uses this library! Also worth checking out if a fork has this fixed.

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

No branches or pull requests

4 participants