Sorry to disturb you again. Could you please help me with how to import material-icons as you mentioned in the following line?
st.markdown(‘face’, unsafe_allow_html=True)
That’s a cool idea, but we’ll have to think a bit about how it fits with the rest of the API. For example, should icons be clickable? How would st.css interop with our planned horizontal/grid layout APIs? etc.
In the meantime, you could always create your own library and share with the community through Github
Something like:
(NOTE: This code is untested!)
import streamlit as st
def local_css(file_name):
with open(file_name) as f:
st.markdown('<style>{}</style>'.format(f.read()), unsafe_allow_html=True)
def remote_css(url):
st.markdown('<style src="{}"></style>'.format(url), unsafe_allow_html=True)
def icon_css(icone_name):
remote_css('https://fonts.googleapis.com/icon?family=Material+Icons')
def icon(icon_name):
st.markdown('<i class="material-icons">{}</i>'.format(icon_name), unsafe_allow_html=True)
EDIT: Found the static html folder, I’ll just symlink my generated htmls inside it for the time being. It’s a bit of a sketchy workaround, but it’s okay for now![/quote]
Nice hack workaround! You could also copy your JS/CSS into that folder from within Python, so anyone running your app would get the hack for free.
For that, you’d have to find the root folder for Streamlit by using os.path.dirname(st.__file__)
Nice hack workaround! You could also copy your JS/CSS into that folder from within Python, so anyone running your app would get the hack for free.
For that, you’d have to find the root folder for Streamlit by using os.path.dirname(st.__file__)
Wow, that is all that was needed to make the hack perfect! Thank you, and I’m still looking forward to the plugins
Have a nice day!
Thanks for working on Streamlit. It’s a great tool. I definitely hear your concerns about how would st.css play nicely with the planned grid layout API, but I still think there is a use-case for custom user-defined css. For a specific example, how else do I color/size my titles and links to match my product branding? Even if we could pass in custom options to those fields, I would still prefer to have the full low-level control enabled by writing my own css which takes precedence over the streamlit-default css. My hope is that you don’t deprecate the st.markdown(..., unsafe_allow_html: True) option before we have another way to accomplish that.
I have user texts in my data that may or may not contain line breaks, sometimes two in a row. It seems that the markdown processor does something strange when this happens. Only the first paragraph is enclosed in the HTML tags:
<div class="markdown-text-container stText" style="width: 698px;">
<div style="font-size: small;">This is paragraph 1 text.</div>
<p>This is paragraph 2 text.</p>
<p>This is paragraph 3 text.</p>
</div>
All I really want is some way to have the text stand out, be word-wrapped, and respect line breaks in the original text. I wanted to use markdown blockquote but the prepending a “>” to the document only blockquotes the first paragraph. What’s the best way to do this?
I’m curious what your application for directly specifying RTL would be. I’ve been able to create text in RTL languages using st.write without any special markup around them, relying on browser detection only.
Since this is a thread asking “what are you using HTML for”, I’m wondering how far you can get in Streamlit without using HTML for what you are doing @mzeidhassan.
I work a lot with geo-annotated data so I render a LOT of maps. deck_gl_chart on streamlit is nice but it’s still extremely limited so I’m still using folium, an awesome mapping library.
I’m able to embed folium maps on streamlit using
m = folium.Map(location=[45.5236, -122.6750])
st.write(m._repr_html_(), unsafe_allow_html=True)