burodepeper / language-markdown

Add support for Markdown to Atom (including Github flavored, Markdown Extra, CriticMark, YAML/TOML front-matter, and R Markdown), and smart behavior to lists.
https://atom.io/packages/language-markdown
MIT License
119 stars 295 forks source link

Blows up on named preformatted code blocks #239

Closed mcandre closed 5 years ago

mcandre commented 6 years ago

GitHub Flavored Markdown allows code blocks to indicate the syntax name by placing the name immediately after the opening triple backticks:

$ echo hello
hello

However, language-markdown is not aware of this feature and mistakenly renders the entire code block, backticks and all, as normal paragraph text in the main file editor view.

The markdown preview pane is unaffected by this glitch.

burodepeper commented 6 years ago

This package has the same feature, but it does not recognize every language. console from your example indeed doesn't work. You can make a suggestion by what language package your code should be handled, and it's mostly likely trivial to add support for this.

mcandre commented 6 years ago

Ha, I foeget where I originally saw console used, but ever since, I’ve been noting it for my terminal snippets. Is there a better language name to use here?

Note that sh/bash wouldn’t be quite right, as the snippets begin with a prompt, either dollar for UNIX snippets or greater-than for Windows snippets.

burodepeper commented 6 years ago

I've mirrored the code from the language-gfm repo (https://github.com/atom/language-gfm/blob/master/grammars/gfm.cson#L609-L625). It uses either shellsession or console as language name.

I'll publish it in the next version. Might take a little while though.