language-markdown
language-markdown copied to clipboard
Add R Markdown support (part deux)
- [ ] Add better/wider support for using functions as attribute values (ie,
{r code=capture.output(dump('fivenum', ''))}
) - [ ] Use value of
engine
attribute to parse the contents of the code-block - [x] Bug: trailing space shouldn't be needed, ie:
{r }
The tailing space issue, I found it's more serious than it looks. See the two screenshots:
without tailing space:
with tailing space at line 2:
I can't tell for sure from your minimap screenshots, but my first impression is (because that has been the case more often) that the fenced-code-block doesn't close properly until it finds a next ```
instead of the one you intended. If you feel comfortable with it, I invite you to try your hand at a fix. The code that's causing this can be found here.
This should be more clear.
It seems it not recognizes the whole
pattern don't met this issue.{js}</code> pattern, until a tailing space is added. However, the <code>
{r}
I'll try to fix it
Yeah, that's what I meant. In your second example it detects the start of the code-block on line 10, but it doesn't detect the closing element until line 18. Let me know if you figure it out, and feel free to PR any changes into this dev-r-markdown
branch.
#139 fix it
The trailing space is trivial to fix.
With the current compiled grammar, i.e. for js: https://github.com/burodepeper/language-markdown/blob/de31dac4aea668fd472f41b0a9130deee474c1b6/grammars/language-markdown.json#L3106
The regex includes the group (?=( |$|{))
after the language name, which forces a space (or $
or {
after the language name. Changing this to e.g.:
(?=(}| |$|{))
fixes the trailing space problem.
r
without the trailing space always worked because the grammars/repositories/flavors/rmarkdown.cson
file didn't require a space after {r}
and that file was included before the general code.