feat: add download as markdown button to bookmark cards#61
feat: add download as markdown button to bookmark cards#61davidorban wants to merge 1 commit intoviperrcrypto:mainfrom
Conversation
Adds a FileText button (visible on hover, left of the existing media download
button) that exports a bookmark as a Markdown file.
The exported file contains:
- Author, date, tweet URL, and categories as a header
- Full stored tweet text (with URLs preserved, so truncated threads still
show their t.co continuation link)
- A note when the text appears to be a truncated thread (ends with t.co URL)
- Embedded image links for photo media; video/GIF as linked references
The download is entirely client-side — no new API routes, no new dependencies.
The file is named tweet-{tweetId}.md.
Co-Authored-By: Oz <oz-agent@warp.dev>
xkonjin
left a comment
There was a problem hiding this comment.
Code Review: Download as Markdown Button
Overall: Clean, focused feature addition. The markdown generation logic is straightforward and handles the common cases well (photos, videos, thread detection via t.co links).
What looks good
- Good use of
FileTexticon to distinguish from media download - Markdown structure includes author, date, categories, and media
- Thread detection via TCO_REGEX is a nice UX touch
- Proper cleanup of object URL after download
Issues to consider
1. Sanitization of bookmark content (security)
The markdown content is generated from user data without escaping. If these fields contain markdown syntax characters, the output may render unexpectedly. Consider escaping markdown metacharacters or documenting that this is as-is export.
2. Filename collision risk
tweet-${bookmark.tweetId}.md could collide if multiple bookmarks reference the same tweet. Consider adding a timestamp or counter.
3. No tests
A simple test verifying the download flow and markdown structure would prevent regression.
Minor suggestions
- The handleDownload function could be extracted to a utility for easier testing
- Consider adding charset to the blob type:
text/markdown;charset=utf-8
Summary
Adds a FileText button (visible on hover, left of the existing media download button) that exports any bookmark as a
.mdfile with a single click.What's exported
Design decisions
for inline display in any Markdown viewer; videos/GIFs become links back to the tweettweet-{tweetId}.mdfor easy identificationChanges
components/bookmark-card.tsx— addsFileTextimport,handleDownloadMarkdown()function, and the hover button (1 file, +62 lines)Checklist
npx tsc --noEmitpasses