Summary
Displaying a Twitter share button using markdown is changing either the font, zoom level or both. See the screenshots below:
Steps to reproduce
From: streamlit-demos/01_🐦_Tweet_button.py at main · ShruAgarwal/streamlit-demos · GitHub
Code snippet:
import streamlit as st
st.title("Markdown bug")
st.caption('Output')
def tweet_button(tag: str,
link: str,
text: str,
user: str):
tweet = f"""
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<a href="https://twitter.com/intent/tweet?url={link}&text={text}&via={user}&hashtags={tag}">
<button class="ui twitter button large ui button">
<i class="twitter icon"></i>
Tweet
</button></a>
"""
st.markdown(tweet, unsafe_allow_html=True)
st.write("")
tweet_button(tag='streamlit, share',
link='https://30days.streamlit.app/',
text='Streamlit share button',
user='streamlit')
st.write("")
st.write('📌 NOTE: This button only works if you have a valid Twitter account.')
On https://shru-examples.streamlit.app, navigate to the page “Tweet button” and see the page change.
Expected behavior:
Display the markdown widget only
Actual behavior:
Display the markdown widget and change font/zoom level of all text on the page
Debug info
- Streamlit version: 1.22.0
- Python version: 3.9.2
- OS version: Github Codespaces + Streamlit Cloud
- Browser version: Brave + Firefox Focus
Requirements file
streamlit