jonschlinkert / sublime-markdown-extended

Top 100 Sublime Text plugin! Markdown syntax highlighter for Sublime Text, with extended support for GFM fenced code blocks, with language-specific syntax highlighting. YAML Front Matter. Works with ST2/ST3. Goes great with Assemble.
https://github.com/jonschlinkert
MIT License
660 stars 96 forks source link

Doesn't highlight fenced code blocks in lists. #8

Closed inetfuture closed 9 years ago

inetfuture commented 11 years ago

This kind fenced code block doesn't get highlighted:

- item1
- item2

  ```js
  var t = new Date():


Could you support this? Thanks.
jonschlinkert commented 11 years ago

Fenced code blocks in lists are supported in markdown in general? That's new to me.

I could possibly put something together, but it seems like an edge case.

inetfuture commented 11 years ago

At least it was supported on github, look:

Or, you can give me some clues so that I can hack your tmLanguage file. I'm new to this kind stuff.

Thanks.

jonschlinkert commented 11 years ago

I'm still thinking about this. I'm not sure the code debt is worth it. The amount of additional code and regex required seems disproportionate with the payoff. Anyway, see this block of code: #L117-L144

This is the regex for the beginning of a code block: #L119

And this is the regex for the closing: #L134

As you can see, what is happening is that there are capture groups for the code fences, as well as the language that will be used for syntax highlighting inside of the fenced code block. Currently, the regex required to make this happen is very simple, if we add what you're requesting it just complicates the regex and increases the potential for bugs. However, if you implement the regex and test it out, and you don't have any issues I'd be happy to merge it in.

vovkkk commented 11 years ago

@jonschlinkert what's the difference from knockdown? I've submitted there similar issue https://github.com/aziz/knockdown/issues/9 Not sure, where to send pr, afaik, @aziz is too busy for prs.

And why have you @jonschlinkert deleted support for the most perfect language?!!! I mean Python :smile:

Speaking about fix, it's done, but I think I should test it better, couple of days probably

pic 2013-07-12 22 05 36 2013-07-12 22 05 36

jonschlinkert commented 11 years ago

@vovkkk I would sent the PR to @aziz first, and if he has time to merge it in then I can grab it from there. Then I'll add a note on this project that it came from that repo. I don't want to take away from the great work that he has done on knockdown. To see the differences in code, it's probably easier to just do diff between the projects, but in terms of "intent", I created this project to maintain support for markdown with monokai specifically in mind.

I can re-add python, as I mentioned in a previous commit I just stripped it because I was trying to fix a bug. But I think I tracked it down to some bad regex (that I added ;-), so I'll try re-adding it.

jonschlinkert commented 11 years ago

@vovkkk did you ever get this resolved?

vovkkk commented 11 years ago

Ah, yes, it's in knockdown already, sorry, I forgot to tell you. https://github.com/aziz/knockdown/commit/c58fb71b5f6d70ef2a3652ca0794da29c45b46b5 https://github.com/aziz/knockdown/commit/95d009178761577347b6cca74d6f34bcee4eabea

jonschlinkert commented 11 years ago

No prob, I'll close here and probably merge in some of those changes (with attribution of course). thanks!

JeanMertz commented 9 years ago

@jonschlinkert I guess this was never merged/included? A pity.

jonschlinkert commented 9 years ago

pr is always welcome.

jonschlinkert commented 9 years ago

closing, but if someone wants to do a pr to add this I'd be happy to merge