Markdown in an if statement

Hello everybody,
I’m trying to write a paragraph in markdown inside an if statement (login check)
but I get it inside a code cell, the code was working correctly before putting it into the if statement

if LOGGED_IN == True:
    
    st.markdown('''___\n
    bla bla bla
    ___''')

That’s because you are adding whitespace in the string itself, i.e., the four spaces (or maybe a tab?) before bla bla bla.

import streamlit as st

LOGGED_IN = True

"🥪 Desired:"
st.markdown("""___\n
bla bla bla
____""")

"❌ With `    bla bla bla`"
if LOGGED_IN == True:
    st.markdown("""___\n
    bla bla bla
    ____""")

"✅ With `bla bla bla`"
if LOGGED_IN == True:
    st.markdown("""___\n
bla bla bla
____""")

2 Likes

:heart: solved!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.