language-markdown icon indicating copy to clipboard operation
language-markdown copied to clipboard

Support Pandoc's Raw Attribute

Open kylebarron opened this issue 7 years ago • 3 comments

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.

kylebarron avatar Jun 19 '18 14:06 kylebarron

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.

allefeld avatar Jan 02 '20 23:01 allefeld

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).

stefanocoretta avatar Apr 07 '20 07:04 stefanocoretta

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

burodepeper avatar Apr 16 '20 09:04 burodepeper