Fenced code doesn't work unless there's a newline before it
Github markdown recognizes two formats (although format is a little strong word for this) for code blocks, one that starts from the left margin and the other that starts indented, aligned with text. The first format is achieved by putting one or more empty lines before code fence, and the second one is achieved by not putting any empty lines between text and code fence. It seems that this second format doesn't work in knockdown:
At first, I thought it's similar to #9 but
the second one is achieved by not putting any empty lines between text and code fence.
I maybe misunderstood, but code block should be either unindented or placed within list item that is 'the four-space rule'
here's what Github render (no indent, no emptyline)
- text
class Array(
val contents: Array[String]
now with four-space rule and blank line
-
text
class Array( val contents: Array[String]
Moreover, https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks
Keep in mind that both types of code blocks need to have a blank line before them
Anyway, I would really appreciate if you check #9 and there's link to fix I tried to make, I have not enough time to check everything, so would be nice if you let me know that fix work for you or there's something wrong.
Thanks for checking this out. I must admit I did not RTFM, I simply tried both options in Github wiki and noticed the discrepancy. Will try when I get home, in 3 hrs.
On Thursday, August 1, 2013, Vova Kolobok wrote:
At first, I thought it's similar to #9https://github.com/aziz/knockdown/issues/9but
the second one is achieved by not putting any empty lines between text and code fence.
I maybe misunderstood, but code block should be either unindented or placed within list item that is 'the four-space rule'
here's what Github render (no indent, no emptyline)
- text scala class Array( val contents: Array[String]
now with four-space rule and blank line
text
class Array( val contents: Array[String]
Moreover, https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks
Keep in mind that both types of code blocks need to have a blank line before them
Anyway, I would really appreciate if you check #9https://github.com/aziz/knockdown/issues/9and there's link to fix I tried to make, I have not enough time to check everything, so would be nice if you let me know that fix work for you or there's something wrong.
— Reply to this email directly or view it on GitHubhttps://github.com/aziz/knockdown/issues/13#issuecomment-21919741 .
Ok, let me demonstrate the difference in behavior between github and sublime knockout.
Here's a github MD example of adding a newline between a bullet and code block:
How that actually looks:
Same thing, but with no newline:
Which looks like this:
And in Sublime, with newline:
Sublime, without newline:
I hope this makes the discrepancy clearer. Thanks
You're right. it seems github deviating from standard markdown in this case. in Markdown code blocks should be preceded by an empty line. I've reopened the issue.
@vovkkk I cloned your repo but it works the same way as the original. Thanks
I'd like to help out, but I suck at tmlanguage syntax :)
tmlanguage syntax sucks!
So Github renders differently in comments and in wiki! LOL, because now if one say 'GitHub Flavored Markdown' you have ask 'which of them?'
I cloned your repo but it works the same way as the original
Mmm, did you switch branch, restart Sublime? or maybe you're on ST3? I didn't test that on ST3 yet.
Well, after brief test in ST3 it works for me as well as in ST2.
@mbonaci please make sure you use right branch (not master, but code-inside-lists) and restart Sublime.

Ups, you're right, I used Master, sorry about that. It works, great job! Thanks to both of you @aziz and @vovkkk
@vovkkk The same thing applies to quote blocks (> ), github indents them if no newline, your knockdown code-inside-lists doesn't format it with no newline (ST3):

To slip you this one up, while you're in the mood... :)
@mbonaci inclusion block_quote into list-paragraph should do the trick. However, list-paragraph already includes inline, and block_quote also includes inline; so some sort of recursion should be expected, rearrangement for regexes is needed, so it is far away from what I call 'easy fix'. Maybe someday I will have enough time and bravery for this issue, unless one fix it before.
Besides, fwiw, default Markdown.tmLanguage doesn't define blockqoute within lists, although it's in 'official' spec, so again it's complex issue.
I understand, of course. For now, I decided to go with newline before each block quote. Let it stick out, what a hell :)
PS the only reason I'm reporting these is because I'm slightly obsessive-compulsive about formatting. I'm sure no normal person would even notice the difference ;) Great work, both of you.