Dear Streamlit Community,
I am building an app where I want to show a documentation page, when a button is clicked.
I embed this documentation page using the function streamlit.components.v1.html.
The embedded document is an html file created with word that contains internal links/references between different chapters.
However, when such a link is clicked, the layout of streamlit messes up:
I provide a dummy code and a dummy code here:
import streamlit as st
import sys
from streamlit.web import cli as stcli
#Note
# pip uninstall altair
# pip install altair=4.0.0
# is needed (newer versions of altair seem not to work)
def main():
# Reset input widgets upon button click
def on_click_button_userguide():
#The loaded file must be an html with all images embedded (i.e. not in a separate folder!)
with open("test.html", 'r', encoding="utf-8") as f:
DokuHtml = f.read()
alignment_style = """
<style>
.main {
align-items: flex-start;
}
</style>
"""
st.markdown(alignment_style, unsafe_allow_html=True)
st.components.v1.html(DokuHtml, width=1500, height=50000)
st.sidebar.button("FAQ / User Guide", on_click=on_click_button_userguide)
if __name__ == '__main__':
#Run streamlit app
if st._is_running_with_streamlit:
main()
else:
sys.argv = ["streamlit", "run", sys.argv[0]]
sys.exit(stcli.main())
You can use any dummy html test.html file in utf-8 formatting that contains internal links.
I would very much appreciate your help to get that fixed.
I would like to display the FAQ section with working internal (and external) links.
Thanks already in advance!