RMarkdown mode

Hi Streamlit-folk,

I only recently learned about streamlit and think it looks great! I am wondering about two potential features that are either already implemented somehow or might be in a pipeline. I realize Streamlit is somewhat analogous to Shiny, but I am thinking from the perspective of someone performing ad hoc data analyses or report generation.

  1. Is it possible to export the page as a “standalone” HTML file or pdf etc. for the generation of reports? Bokeh/plotly allow this through embedding of necessary scripts etc.
  2. Would it be possible to implement something like an RMarkdown mode? Instead of a Python source file that is consumed, streamlit would consume a Markdown file containing fenced code blocks.

Definitely looking forward to using streamlit in my own projects!

Uri

1 Like

Hi @laserson

To the best of my knowledge 1. is not supported. See https://github.com/streamlit/streamlit/issues/297

As I see it implementing something like 2. would be doable. I’ve actually been thinking about it. I think that kind of mode would be very usuable when you do more (technical) writing than coding. I imaging that it should be “easy” to create a script to convert RMarkdown to Streamlit Python that can then be run by Streamlit.

You can file a feature request here https://github.com/streamlit/streamlit/issues/new/choose

Hi @laserson — belated welcome to Streamlit! :smile:

@Marc’s responses are totally right (thanks @Marc!), but I just wanted to add some more info:

  1. Is it possible to export the page as a “standalone” HTML file or pdf etc. for the generation of reports? Bokeh/plotly allow this through embedding of necessary scripts etc.

You have two options today:

  1. You can save a “snapshot” of your app to AWS S3 (if you have your own S3 account). See this for instructions
  2. You can use your browser’s “print” dialog the Streamlit app to PDF!
    (Except this is actually broken right now, but we just merged a fix into the develop branch. So it will be fixed in the next Streamlit release in a week or two)

Also, we’re considering extending (1) to allow you to write to a local folder rather than only S3. See the feature request here. Please upvote it over there if you think this would be useful, or add comments if you have ideas on how it should work!

  1. Would it be possible to implement something like an RMarkdown mode? Instead of a Python source file that is consumed, streamlit would consume a Markdown file containing fenced code blocks.

As @Marc said, this is not supported today. But you can do the opposite: you can write Markdown inside a Python file. The end result is actually quite similar:

This is what you want to do, but Streamlit does not support today:

[Filename: hello.md]

```
import streamlit as st
```

Hello **world!**

```
x = st.slider("Pick a number!")
```

Here's what you selected:

```
x
```

And here’s what you can do with Streamlit today:

[Filename: hello.py]

import streamlit as st

"""
Hello **world!**
"""

x = st.slider("Pick a number!")

"""
Here's what you selected:
"""

x
1 Like