Comments (5)
SO does not support fenced code blocks, so you need to indent by 4 spaces, and you can use the output format rmarkdown::md_document
.
from reprex.
reprex does already do this, using md_document
as @yihui points out. Request venue = "so"
, like so:
library(reprex)
so_md <- reprex({
x <- 1:4
y <- 2:5
x + y
}, venue = "so")
writeLines(so_md)
#> <!-- language-all: lang-r -->
#> <br/>
#>
#> x <- 1:4
#> y <- 2:5
#> x + y
#> #> [1] 3 5 7 9
Note the output you want (SO-ready markdown) should also be waiting on your clipboard after this little exercise.
I am tickled that I just used reprex to make a reprex, formatted for GitHub, demonstrating formatting of StackOverflow. META.
from reprex.
But, @baptiste, back to your title. reprex takes R code as input, not Rmd. I think that's the right call, because these little snippets are going to be mostly R code. You can still include prose, by prefixing with #'
. The examples and README show this. When I use it on GitHub, I often write the prose part of my comment normally, then paste the reprex result in.
from reprex.
from reprex.
OK I will close for now, but keep this in mind.
I think if you've already psyched yourself up to write Rmd, a workflow helper like reprex isn't so relevant. Because you've already done most of the busy work that reprex handles anyway! The other 2 things it brings to the table then are:
upload.fun
defaulting to imgur upload, as @baptiste points out- putting Markdown on the clipboard
from reprex.
Related Issues (20)
- Warning that R appears to crash when it does not HOT 1
- Thoughts about talking about reprexes HOT 1
- Error in xfun::normalize_path() : unused argument (resolve_symlink = FALSE) HOT 2
- reprex:::reprex_addin() on posit cloud does not show the preview HOT 1
- Take advantage of some backtrace improvements HOT 3
- Running in non-interactive mode using the `input` argument seems to use an existing `<input>_reprex.R` HOT 2
- Reprex v2.0.2 does not print all columns of bench::mark() HOT 1
- Upkeep for reprex
- Reprex skipping some statements (these should cause an error) HOT 2
- Add wd panel to Rstudio Addins Menu HOT 1
- Error in `reprex_render_impl()` HOT 3
- Unable to generate a reprex due to possibly clipboard or file connection issue HOT 2
- Question: Does `{reprex}` support MS Teams? HOT 4
- Error in reprex_render_impl() HOT 1
- Don't show the full backtrace HOT 1
- Output when following documentation instructions does not match expected result HOT 2
- Release reprex 2.1.0
- Enhance `would_clobber()` with more help getting rid of the offending file
- Error in read_xml.raw(res) : Start tag expected, '<' not found [4] HOT 4
- Warning exists when `reprex(... style = FALSE)` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reprex.