Skip to content

Commit

Permalink
Merge pull request #9 from arnaudmiribel/fix-caching
Browse files Browse the repository at this point in the history
Fix caching
  • Loading branch information
arnaudmiribel authored Apr 7, 2023
2 parents fd752fd + 2a6f707 commit 1c7be36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions markdownlit/extensions/at_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
from markdown.inlinepatterns import InlineProcessor
from streamlit_extras.mention import mention

try:
from streamlit import cache_data # streamlit >= 1.18.0
except ImportError:
from streamlit import experimental_memo as cache_data # streamlit >= 0.89

SUPPORTED_PLATFORMS = ("github", "notion", "twitter", "streamlit")
GITHUB_ICON = "https://cdn-icons-png.flaticon.com/512/25/25231.png"
NOTION_ICON = "https://upload.wikimedia.org/wikipedia/commons/4/45/Notion_app_logo.png"
Expand Down Expand Up @@ -64,13 +69,13 @@ def handleMatch(self, m: re.Match, data=None) -> Tuple[etree.Element, int, int]:
return el, m.start(0), m.end(0)

@staticmethod
@st.experimental_memo
@st.cache_data
def _get_favicon(url: str) -> str:
favicons = favicon.get(url, timeout=2)
return favicons[0].url

@staticmethod
@st.experimental_memo
@st.cache_data
def _get_page_title(url: str) -> str:
n = requests.get(url)
al = n.text
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "markdownlit"
version = "0.0.5"
version = "0.0.6"
authors = [
{ name="Arnaud Miribel", email="arnaudmiribel@gmail.com" },
]
Expand Down Expand Up @@ -32,4 +32,4 @@ keywords = [

[project.urls]
"Homepage" = "https://github.com/arnaudmiribel/markdownlit"
"Bug Tracker" = "https://github.com/arnaudmiribel/markdownlit/issues"
"Bug Tracker" = "https://github.com/arnaudmiribel/markdownlit/issues"

0 comments on commit 1c7be36

Please sign in to comment.