Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent view of unordered list (markdown + expander) #4111

Closed
shashankdeshpande opened this issue Dec 1, 2021 · 4 comments · Fixed by #7247
Closed

Inconsistent view of unordered list (markdown + expander) #4111

shashankdeshpande opened this issue Dec 1, 2021 · 4 comments · Fixed by #7247
Labels
area:styling feature:st.expander priority:P4 status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working

Comments

@shashankdeshpande
Copy link

Summary

Inconsistent view of unordered list, difference in bullet points as follows -

Markdown inside expander

Code snippet:

import streamlit as st
with st.expander('Expand this', expanded=True):
    st.markdown('''
        List of items
        - item 1
        - item 2
        - item 3
    ''')

Output:
Screenshot (27)


Markdown

Code snippet:

import streamlit as st
st.markdown('''
    List of items
    - item 1
    - item 2
    - item 3
''')

Output:
Screenshot (29)

@shashankdeshpande shashankdeshpande added type:bug Something isn't working status:needs-triage Has not been triaged by the Streamlit team labels Dec 1, 2021
@kaydotdev
Copy link
Contributor

@shashankdeshpande, as far as I understood, it's not a bug. The thing is, you used two TABS in the markdown list, so the parser interprets them as nested elements of a list. Just remove one tab, and it should work:

import streamlit as st
with st.expander('Expand this', expanded=True):
    st.markdown('''
        List of items
    - item 1
    - item 2
    - item 3
    ''')

@mayagbarnes mayagbarnes added status:confirmed Bug has been confirmed by the Streamlit team type:enhancement Requests for feature enhancements or new features priority:P4 area:styling and removed status:needs-triage Has not been triaged by the Streamlit team type:bug Something isn't working labels Dec 1, 2021
@shashankdeshpande
Copy link
Author

@antonace Thanks for suggestion! Tried removing tab but it's not working. I guess this is a bug as we are not getting same view for same markdown text.

Code snippet:

import streamlit as st
default_val = '''
List of items
- item 1
- item 2
- item 3
'''
markdown_text = st.text_area('Enter markdown text', value=default_val)
col1, col2 = st.columns(2)
col1.markdown(markdown_text)
with col2.expander('Expand this', expanded=True):
    st.markdown(markdown_text)

Output:

Screenshot (31)

@jrieke jrieke added type:bug Something isn't working and removed type:enhancement Requests for feature enhancements or new features labels Sep 23, 2022
@jrieke
Copy link
Collaborator

jrieke commented Sep 23, 2022

Marking this as bug again. The example above actually doesn't work correctly, even though it should. Seems to be conncected to the expander.

@kmcgrady
Copy link
Collaborator

Did some initial investigation, but it looks like the bug is a result of the fact that the expander is considered a ul and the list is a ul. So the marker is defined a s a sub-list. Seems like we need to manage this differently so the expander is not a ul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:styling feature:st.expander priority:P4 status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants