Discord-style link previews (Material cards) for MkDocs at build time.
Project description
mkdocs-link-cards
Discord-style link previews for MkDocs, rendered as Material cards at build time.
- ✅ Static HTML output (GitHub Pages friendly)
- ✅ YouTube, arXiv, X/Twitter adapters
- ✅ Generic OpenGraph/Twitter/JSON-LD fallback
- ✅ Cache with TTL, polite UA/timeouts
- ✅ Typed, linted (Ruff), MyPy-clean, tested
Install
poetry add mkdocs-link-cards
# or: pip install mkdocs-link-cards
Configure (mkdocs.yml)
plugins:
- search
- link-cards:
ttl: 604800 # 7 days
timeout: 8
allow_domains: [] # optional safelist
deny_domains: [] # optional blocklist
Use in Markdown
[[card https://arxiv.org/abs/2501.01234]]
[[card https://www.youtube.com/watch?v=dQw4w9WgXcQ title="Optional override"]]
[[card https://x.com/trydaily/status/1840107...]]
[[card https://example.com/interesting-article]]
The plugin outputs Material’s card markup, so your site inherits all theme styles:
<div class="grid cards" markdown>
- <img ... class="linkcard-img">
<strong>Title</strong>
<small>Site</small>
---
Description...
<a class="md-button" href="...">Open</a>
</div>
Notes
- Static: previews update when you rebuild (or when cache TTL expires).
- Privacy/Robustness: Icons are data-URIs. Thumbnails are remote (YouTube); others are taken from page metadata if available.
- CI: tests mock the network; builds are deterministic.
Extras
Optional extras (not required):
poetry add mkdocs-link-cards[oembed]
poetry add mkdocs-link-cards[summarize]
Roadmap
- Provider adapters for GitHub repos, Substack, arXiv PDF direct links
- Async fetch with
httpx+ concurrency controls - CLI:
mkcards warm docs/to pre-cache links - Jinja templates for custom card layouts
License
MIT © Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs_link_cards-0.1.0.tar.gz.
File metadata
- Download URL: mkdocs_link_cards-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.10 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3e946e1d1275b2eca8c8b56eedfa8a565405a04634f4e3856c77abb5779dd6
|
|
| MD5 |
c399c10b16575386cea8c40218d47bca
|
|
| BLAKE2b-256 |
bb63555c74a4ccb106f1666bb880eae7036c0d07bbd413449df60418f6472a88
|
File details
Details for the file mkdocs_link_cards-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mkdocs_link_cards-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.10 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acb9f0645ee7903a6e339e4b13c390254a0cd2dac94f8ef83dfcfa4dce11006a
|
|
| MD5 |
d89b92983eee8159bf3cae55b87f2d0a
|
|
| BLAKE2b-256 |
12f1172db4bfc087b419c5d9cc64680b843fb96b492bd1925290016cedfabc13
|