RMarkdown mode

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