atom / language-gfm

GitHub Flavored Markdown in Atom
MIT License
101 stars 107 forks source link

Markdown syntax highlighting fails after ``` #21

Open peterbe opened 10 years ago

peterbe commented 10 years ago

screenshot 2014-04-21 11 01 17

It's reproducible every time with this file in Atom 0.90.0

kevinsawicki commented 10 years ago

I think this is because that <style> element is never closed with a </style> and so it is still assuming it is parsing over CSS when it hits the ```

chaimleib commented 10 years ago

Also breaks when I put in ` (literal backtick, outside of a code block)

gjtorikian commented 10 years ago

I've hit the same issue, with a JSON blob:

screen shot 2014-07-19 at 9 05 23 am

The JSON is not valid (due to the ...), but everything else looks like angry text.

13protons commented 10 years ago

Similar issue, this time with not being able to handle long code fences for displaying markdown code. screen shot 2014-10-03 at 5 10 54 pm

kevinsawicki commented 10 years ago

@alanguir I just fixed your issue in https://github.com/atom/language-gfm/commit/c3a70e3b1295e0c51d83a9f970e4d024338b89cb

It should now parse code blocks inside of code blocks correctly

screen shot 2014-10-06 at 11 10 10 am

This will be included in the next Atom release, 0.136

13protons commented 10 years ago

@kevinsawicki Awesome, thanks for picking that up so quickly

13protons commented 10 years ago

@kevinsawicki what library was being used for that originally? It looks like even gists showed that same parsing behavior of not catching nested code blocks

kevinsawicki commented 10 years ago

what library was being used for that originally? It looks like even gists showed that same parsing behavior of not catching nested code blocks

I think Gist uses a derivative of https://github.com/vmg/sundown with additions using https://github.com/jch/html-pipeline

ArtskydJ commented 9 years ago

Got the same issue in atom v1.0.7.

atom-gfm

A newline between > text here and ''' highlights the remaining text correctly.

fcharlie commented 9 years ago

C++ syntax highlighting fails after 2015-10-15 14 39 24

like those Render Success: 2015-10-15 17 12 52

struct Foo{
  void* p;
};

Render failed: 2015-10-15 17 12 36

struct Foo{
  void *p;
};

Atom 1.0.19 on Ubuntu 15.04

winstliu commented 9 years ago

@fcharlie that is a different bug. Please see #44.

cucumbur commented 7 years ago

Similar issue here: screenshot 2017-02-03 15 37 48

illpack commented 7 years ago

Same problem here in Atom 1.14.4 Hints? capture

winstliu commented 7 years ago

For now you have to completely close all your code snippets (in your case, make sure that they are valid Java).

bric3 commented 7 years ago

@50Wliu In my opinion that can't be valid if this is a snippet. The point of a snippet is to highlight part of a larger code base.

bric3 commented 7 years ago

@50Wliu Another point, languages evolves. For example I have a valid Java code, but Atom does not recognise the valid syntax in the snippet, and as such it is not correctly closed.

In this code, the java language doesn't understand the try with resources (yet it's pretty old).

screen shot 2017-05-05 at 18 03 42
winstliu commented 7 years ago

Yeah, I completely understand. The problem is at this point we have no way to force-close the code snippet.

(Also, try-with-resources support requires more work than it looks like)

bric3 commented 7 years ago

@50Wliu Yes this problem seems to be related to this issue https://github.com/atom/language-java/issues/88. Thanks for feedback by the way !

In my opinion issues in the sub language plugin should not affect the gfm plugin. I am not a maintainer of this project so I dont know how hard it would be to do that.

dead-claudia commented 7 years ago

BTW, I located the source of the bug in atom/first-mate#83 (missing feature, actually).

zalloy commented 5 years ago

Looks like this bug hasn't been updated in a while. I'm running into this issue using Atom 1.40.1 on Linux. I've got this set of Markdown files that I'm using with Slate for some API documentation, and each of them has fenced code blocks for both Python and Javascript code examples. I noticed that in one of my files, the editor lost all the syntax highlighting after the first 2 code blocks, which is pretty annoying because it makes errors harder to spot.

Any idea when this might get fixed?

dead-claudia commented 5 years ago

Not sure, but I've been keeping close tabs on this personally as someone heavily affected by it. To my understanding, Atom is migrating from a TextMate variant to Tree Sitter, which solves it by design by basically scoping all grammars by default. There doesn't appear to be a timeline for this AFAICT, but IIUC, language-gfm can't be migrated to Tree Sitter until all its child grammars have Tree Sitter variants.

You could probably glean an idea how much progress has been made based on how many of the child Markdown grammars have been converted.

boevski commented 2 years ago

I've been hitting various problems of this type for years now.

How's that for an idea: Add an option in the plugin Settings to disable syntax highlighting for code snippets? This will take care of any bugs found in other Atom syntax libraries like Java. (Note that I still want the language identifier - ```java - as it is needed by my static site generator. I just don't want it to have any effect in Atom).

As an author, I don't rely too much on syntax-highlighted code snippets anyway as I can see the end result in the static site generator's output.