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

Triple Backtick Code Blocks Have Trouble with New Line #100

Closed
techpines opened this issue Jul 7, 2013 · 4 comments
Closed

Triple Backtick Code Blocks Have Trouble with New Line #100

techpines opened this issue Jul 7, 2013 · 4 comments

Comments

@techpines
Copy link

I have a code block using the triple backtick syntax that looks like this:

bone = require('bone.io');

bone.set('io.options', {server: io;});

For some reason it outputs this:

<p><code></code>`
bone = require(&#39;bone.io&#39;);</p>

<p>bone.set(&#39;io.options&#39;, {server: io;});
<code></code>`</p>

But if I change my code block that is inside that triple backtick block to not have a new line:

bone = require('bone.io');
bone.set('io.options', {server: io;});

It's working just fine:

<p><code>
bone = require(&#39;bone.io&#39;);
bone.set(&#39;io.options&#39;, {server: io;});
</code></p>

I'm guessing it's a bug with the parser?

@ashb
Copy link
Collaborator

ashb commented Jul 8, 2013

So the triple back tick method syntax is not part of the core Markdown syntax - it's an addition from the Github Flavoured Markdown.

I've made a start on supporting the GFM on the gfm branch: https://github.com/evilstreak/markdown-js/tree/gfm - this branch might be slightly out of date and need rebasing - we haven't touched it in a while (but should just be missing a few bug fixes if anything)

@ashb
Copy link
Collaborator

ashb commented Jul 8, 2013

I think this is the problem - but can you update your example so it shows the exact input you are entering (i.e. make sure your input is indented by 4 spaces so it is markdown 'escaped')

@techpines
Copy link
Author

I'm not indenting, I guess I'm trying to do gfm style markdown and the library does not really support it?

https://gist.github.com/techpines/5945812

Since the backtick stuff will cause issues in these github issue dialog boxes, I threw it in that gist above. Which is rendering it :), but you can still click to view it raw.

Right now, I'm just doing a workaround where after I compile with toHTML() I go through and replace all instances of "[NEWLINE]" with whitespace.

Also, I'd say that GFM is pretty cool/useful, and i guess I will throw out how I'm using your markdown library to get syntax highlighting.

There's a library called highlight.js, and it expects code blocks to be <pre><code>, so I'm actually adding the language type after the triple backtick like GFM, but then after it's compiled I'm converting something like this:

<p><code>javascript

To this:

<pre><code class="javascript">

Not sure if that is interesting to you or not, it seems like you are trying to stay true to the real markdown spec, but I wanted to throw it out there in case anyone else was trying to do something similar.

Cheers!

@evilstreak
Copy link
Owner

GFM support is being handled in #41

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

3 participants