I’m trying to include an SVG (in particular a logo) inside a markdown section. So far no success. For example:
st.markdown(
"""
![foo](logo.svg)
""",
unsafe_allow_html=True,
)
What should be the right approach?
I’m trying to include an SVG (in particular a logo) inside a markdown section. So far no success. For example:
st.markdown(
"""
![foo](logo.svg)
""",
unsafe_allow_html=True,
)
What should be the right approach?
Hey @drorata ,
Good question, I think the functionality in this thread is what you’re looking to achieve. Also, this is the associated gist the other thread links out to. Hope this helps!
The links were helpful! Thanks!
Is it planned to be included as another integrated streamlit
writer?
N.B. Maybe someone would find it useful here:
def render_svg(svg_file):
with open(svg_file, "r") as f:
lines = f.readlines()
svg = "".join(lines)
"""Renders the given svg string."""
b64 = base64.b64encode(svg.encode("utf-8")).decode("utf-8")
html = r'<img src="data:image/svg+xml;base64,%s"/>' % b64
return html
Awesome, glad they were helpful ! Yup, this is on the roadmap, here is a feature request tracking it. We’ve been playing around with it internally a bit, but don’t yet have a set timeline for when it will be rolled out. I’ll link this thread inside the above GitHub issue and we’d also love any input or more info about your use cases as well.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.