Streamlit Embed Code

0.1.2 · maintenance · verified Thu Apr 16

streamlit-embedcode is a Streamlit custom component that simplifies embedding code snippets from various popular services, including GitHub Gist, GitLab Snippets, Pastebin, CodePen, Ideone, and TagMyCode, directly into Streamlit applications. The library is currently at version 0.1.2. It has an infrequent release cadence, with the last update in May 2021, suggesting a stable and mature, albeit not actively feature-developed, component.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to embed a GitHub Gist into a Streamlit application using the `github_gist` function. The example also shows how to set optional parameters for the embedded content.

import streamlit as st
from streamlit_embedcode import github_gist

st.set_page_config(layout='wide', page_title='Streamlit EmbedCode Example')

st.title('Streamlit EmbedCode Example')
st.write(
    'This app demonstrates embedding various code snippets using `streamlit-embedcode`.'
)

# Example GitHub Gist
st.subheader('GitHub Gist Example')
github_gist('https://gist.github.com/randyzwitch/be8c5e9fb5b8e7b046afebcac12e5087/')

st.caption('Optionally, you can provide arguments for height, width, and scrolling.')
st.code("""
import streamlit as st
from streamlit_embedcode import github_gist

st.title('My App')
github_gist('https://gist.github.com/randyzwitch/be8c5e9fb5b8e7b046afebcac12e5087/')
""")

view raw JSON →