🔒 Protected via Cloudflare Access
Discord Inline Content Research — Final Findings
The CDN Webview Discovery
When you tap a file attachment on Discord mobile, it opens in an in-app webview pointing to a CDN URL like:
https://cdn.discordapp.com/attachments/{channel}/{msg}/{filename}
Key insight: Discord determines content-type from the file extension, NOT the Content-Type header you send. So:
.txt→text/plain; charset=utf-8→ shows as raw text.html→ would normally betext/html→ but Discord CDN forces download headers.md→ opens in external app on iOS
The CDN sets Content-Disposition: attachment on non-image files, which forces download instead of inline rendering. This is a security measure — Discord doesn't want arbitrary HTML/JS running in their webview.
What's Actually Possible
1. Components V2 TextDisplay (BEST OPTION)
- Up to 4000 chars of markdown across all TextDisplay components
- Full Discord markdown (headers, bold, italic, lists, code, links, spoilers)
- Renders inline on mobile and desktop
- Can combine multiple TextDisplay + Separator + Container for structure
- No collapse/expand — content is always visible
2. Components V2 Container with spoiler: true
- Blurs content, tap to reveal (like image spoilers)
- NOT the same as collapsible — once revealed, stays revealed
- Good for hiding sensitive content, not for progressive disclosure
3. File Preview (Desktop Only)
.txtfiles get inline code preview on desktop- On mobile, opens in webview showing raw text
- No markdown rendering
- "Expand" button only on desktop
4. Image-based Content
- Convert markdown → image (PNG/SVG) → send as media
- Renders inline on all platforms
- Can't be selected/copied, not accessible
- Could use media gallery with spoiler for individual images
What Discord Explicitly Prevents
- No HTML rendering in file attachments (CDN forces download headers)
- No
<details>/<summary>HTML elements in markdown - No webview injection — CSP headers prevent script execution
- No iframe embeds — only specific embed types (link previews)
Recommended Approach for Justin
For long-form inline content:
Use Components V2 with multiple TextDisplay blocks + Container:
{
"container": {"accentColor": "#5865F2"},
"blocks": [
{"type": "text", "text": "## Summary\nBrief overview here"},
{"type": "separator", "spacing": "small", "divider": true},
{"type": "text", "text": "### Details\nLonger content here..."},
{"type": "actions", "buttons": [{"label": "Full Report", "style": "link", "url": "https://..."}]}
]
}
For collapsible content:
No native Discord solution exists. Best alternatives:
- Spoiler container — blur/reveal (one-time)
- Button → edit message — requires interaction handler (custom code)
- Link to external page — host rendered HTML on CF Pages
- Split across messages — summary message + threaded detail
For > 4000 chars:
- Send
.txtfile alongside a V2 summary container - Host on CF Pages and link from the message
- Split into multiple messages with V2 components