How to link a local file or directory by st.markdown?

I want to create a link, when I click it , chrome or firefox can open a new page and show content.
I know following way works.


but when I use a local file path instead a url, it doesnt work. like:




Do you know how to fix it?
Thanks !

Unfortunately, that will not work for a local file sitting in your filesystem, unless it is being served by a server, something like python -m http.server.

Depending on what exactly what you’re trying to do, you might be able to use st.download_button instead to allow the user to download a local file, or simple write the file contents into your app

from pathlib import Path

import streamlit as st


    "Download file", Path("/home/test.log").read_text(), "test.log"

That’s OK, thanks anyway!