-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render RMarkdown (.rmd) as Markdown #343
Conversation
I would dearly love R Markdown files to have syntax highlighting. So +1 for that functionality. |
I don't think that's the right way to go since it will conflict with the tangled web of linguist/Pygments.rb/payments.py that seems to be behind everything. Better, I think, is to generate an .md file with knitr with the results shown in https://gist.github.com/technocrat/113aefb0b0c62f621815 and to require it to be rendered in the Gist as *markdown rather than RMarkdown |
When an R Markdown document exists, it is the source document, relative to any downstream Markdown documents (or HTML, R Markdown and the associated Markdown files are fundamentally different. One is pure source, whereas the other is an automatically generated hybrid of source and results. While I appreciate GitHub's excellent handling of Markdown documents, I believe syntax highlighting of R Markdown documents remains a very useful feature. |
I'm not well-versed in RMarkdown, so I want to make sure I understand: it looks like a superset of markdown. Rendering it as plain markdown would just present R blocks as code blocks. Sound right? If that's the case, I'm 👍. @gjtorikian, @vmg, @ymendel? |
First time I hear of RMarkdown. If it has builtin R documents, I think rendering it with our Markdown renderer will provide weird results. |
I don't know RMarkdown either but that is what I understood too. @TanyaMurphy and @karthik requested this in github-linguist/linguist#990. They probably know more about the RMarkdown syntax. |
@vmg Rmarkdown documents can be rendered exactly the same way as markdown documents get rendered. Currently, I just rename my Here is an example of a https://github.com/htmlwidgets/datamaps/blob/master/README.R.md |
@bkeepers That is exactly the point we are making. Since those of us that practice reproducible research don't always commit files that can be generated, it would help to have these syntax highlighted the same way you do for regular markdown. All the unrendered code blocks should look like regular code blocks with R (or S) syntax highlighting applied. |
+1 to what @ramnathv and @karthik have said. In case we haven't made this clear, in the R world, we render Here's one example of an rOpenSci repo (and R package) with a |
Here is what it would produce if this PR is merged: |
@pchaigno 👍 to your Gist! |
@bkeepers: Based on what I've seen here (especially the gist @pchaigno provided), this seems more than fine. It would be great if we could make it so https://github.com/rOpenGov/enigma/blob/d3949d8ed7383f06680be4d15898d2a6fa7ff78a/README.Rmd displayed like https://github.com/rOpenGov/enigma/blob/d3949d8ed7383f06680be4d15898d2a6fa7ff78a/README.md, but that's a separate effort. |
@ymendel: If I understand your last comparison correctly … I don't think that is necessarily a reasonable(?) goal. Because that would require running all those R chunks, which heads more into the territory of, say, hosting iPython notebooks. Agree that is a separate effort (but also potentially fantastic). |
I'm finding that different implementations of Markdown handle parsing of triple backticks inconsistently. The proposed specification for Common Markdown at https://github.com/jgm/stmd has a rigorous treatment of the rules for code blocks and any modification to GFM should be written to pass the CM test suite and RMarkdown within R, using knitr, should too. That way jennybc's goals of keeping a single .Rmd source file that would be accurately rendered as a gist without having first to be converted to md could be realized and if other Markdown implementations were similarly conformed, the knitr conversion step could also be eliminated for many other purposes. |
This is not what I am asking for. |
@technocrat writes:
This is absolutely not what we are asking for. |
@jennybc @karthik Since I misinterpreted that one (read as native support), assuming that knitr won't be modified to produce CM compliant md files, then GFM needs a way of identifying files converted that way and running a preprocessor to make it compliant. I ran @jennybc 's sample against the stmd suite and the html came out wretched as far as the code blocks went. Pygments should work ok if R code is properly wrapped. |
Are there still concerns or is it ready to be merged? |
Maybe I am missing something completely here, but all that is needed to render an Rmd document in github is to recognize it as a valid markdown extension. Nothing more is needed IMHO. |
I just need to test it to make sure there aren't any weird side-effects and that .rmd docs look good when they're rendered. It's on my list to do today. |
@brandon -- just because this has been a somewhat jagged thread, the two issues are Codeblocks and within codeblocks syntax highlighting On Thu, Sep 11, 2014 at 10:50 AM, Brandon Keepers
|
Thanks @bkeepers! Cheers. |
@karthik if you could link to some file in public repos, I would appreciate it. |
This is looking great on the docs I have tested. I'll combine this with a few other PRs, make a new release of github-markup, and push it to GitHub. Hold onto your 🎩 |
Fantastic! Thanks @bkeepers! 🍻 on me when we meet. |
This is awesome. Thanks @bkeepers! 👍 |
I knew @karthik would have just the right GIF for this. |
Awesome! So when will this show up in Rmd rendering? |
@bkeepers is making a new release so it should show up in just a moment :-) |
This is deployed now. Enjoy! |
This is fantastic! Christmas in SeptembeR. |
Looks great! |
I'm a little late but THANK YOU! |
This PR makes RMarkdown files (
.rmd
) rendered as Markdownl.If I'm right, this should enable rendering for
.rmd
files in Gist? (It would be better than the current situation where there is no rendering at all.)