Reveal.js, Remark.js, and Knitr on regular .md files

Hi all,

I’m new to R Studio and am trying to create slide presentations from .md markdown files. I actually don’t need to include R code and I already have a MD editor I like (Typora) so really I’m only using R Studio for the automatic slide generation process (via reveal or remark).

However, it seems that the knitr tool to make slides only works for file extensions of .rmd. Does anyone know of a way around this?

Obviously changing the files to *rmd would work, but I want my files to be natively read on GitHub, and my main editor doesn’t natively see .*rmd files.

One possible solution is to use rmarkdown::render, which accepts files with .md extension

# Pass it an MD document
rmarkdown::render(input = "file_name.md", output)

# For my example, render will create a 'file_name.html' document in my root folder
# I can then open it through my file explorer or use R commands
browseURL(url = "file_name.html")

To complete @jdb reply,

PANDOC is what is used behind the scene of Rmarkdown. You can do slides directly with PANDOC using a markdown file and converting to the correct supporting format
https://pandoc.org/MANUAL.html#producing-slide-shows-with-pandoc

rmarkdown can be used with md file directly without any R code chunk to run as he shows.

Example for a reveal js presention in a test-reveal.md file

---
title: "Untitled"
output: revealjs::revealjs_presentation
---

## R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Code and no Output

```r
summary(cars)
```

## Slide js code as example

```js
document.getElementById("'para')
```

To render to Html with

rmarkdown::render("test-reveal.md")

Hope it helps

1 Like

Thanks! That is helpful!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.