diff --git a/tuftecms/core/markdown.py b/tuftecms/core/markdown.py index a735285..cec1bf7 100644 --- a/tuftecms/core/markdown.py +++ b/tuftecms/core/markdown.py @@ -33,6 +33,21 @@ def _process_oembed(html): url = match.group(1) if url in _oembed_cache: return _oembed_cache[url] + + # SoundCloud: use compact mini player instead of oEmbed default + if re.match(r"https?://(?:www\.)?soundcloud\.com/.+", url): + encoded = urllib.request.quote(url, safe="") + embed = ( + f'' + ) + _oembed_cache[url] = embed + return embed + + # Everything else: use oEmbed API for pattern, endpoint in _OEMBED_PROVIDERS.items(): if re.match(pattern, url): try: