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

Support Pandoc's Raw Attribute #225

Open kylebarron opened 6 years ago

kylebarron commented 6 years ago

The Readme says that this package supports R Markdown, which to me means that it implicitly supports Pandoc's Markdown. Assuming that's true, 1) it might be nice to add Pandoc's Markdown to the list of supported grammars, and 2) there are some new syntax options that Pandoc 2 brought that aren't highlighted. For example the Raw Attribute extension.

Inline spans and fenced code blocks with a special kind of attribute will be parsed as raw content with the designated format. For example, the following produces a raw groff ms block:

```{=ms}
.MYMACRO
blah blah

It would be helpful to include XML, LaTeX, HTML within these blocks. For example,

```{=latex}
\begin{center}
\begin{tabular}{ c c c }
 cell1 & cell2 & cell3 \\ 
 cell4 & cell5 & cell6 \\  
 cell7 & cell8 & cell9    
\end{tabular}
\end{center}


should be highlighted as LaTeX. I wouldn't expect this to interfere with any current functionality of the package. I can submit a PR if you're interested.
allefeld commented 4 years ago

I second this. I use the package to edit files in Pandoc's Markdown, and as far as I can see, most of the syntax is supported already. But sometimes there are a few things that don't work. One example: emphasis * * within description-list items. I don't think I'm able to patch the package myself, but if there is something I can do to help, I'd be happy to.

stefanocoretta commented 4 years ago

As a temporary solution (minimally tested, so might break things), replace all occurrences of ^\\s*([`~]{3,})\\s*(\\{?) to ^\\s*([`~]{3,})\\s*(\\{?=?) in grammars/language-markdown.json of your local installation of the package. (It will be overwritten when updating the package).

burodepeper commented 4 years ago

@stefanocoretta Would you mind testing your solution a little further and submitting it as a PR?