32 lines
1.7 KiB
Markdown
32 lines
1.7 KiB
Markdown
# RosterChirp — Future Feature Requests
|
||
|
||
---
|
||
|
||
## Markdown Message Rendering
|
||
|
||
**Request:** Render markdown-formatted text in the message window.
|
||
|
||
**Scope recommendation:** Start with inline-only markdown (bold, italic, inline code, strikethrough, links). Full block-level markdown (headers, lists, tables, code blocks) is a follow-on.
|
||
|
||
### Why inline-only first
|
||
- Zero risk of misformatting existing plain-text messages
|
||
- Full markdown risks rendering existing content oddly (e.g. a message starting with `1.` or `#` rendering as a list/header)
|
||
|
||
### Implementation notes
|
||
- Integration point is `formatMsgContent()` in `Message.jsx` — already returns HTML for `dangerouslySetInnerHTML`; a markdown parser slots straight in
|
||
- Add `marked` npm package (~13KB) for parsing
|
||
- Add `DOMPurify` for XSS sanitization — **required**, markdown allows raw HTML passthrough and content comes from other users
|
||
- `marked` config: `{ breaks: true }` to preserve single-newline-as-`<br>` behaviour, `{ mangle: false, headerIds: false }` to suppress heading anchors
|
||
- Apply markdown parse first, then @mention substitution (so `**@[Name]**` renders correctly)
|
||
- Remove the existing URL regex linkifier in `formatMsgContent` — markdown handles links natively
|
||
- Strip markdown from reply previews (currently shows raw `**text**`)
|
||
- `handleCopy` copies `msg.content` (raw markdown source) — correct behaviour, no change needed
|
||
- Emoji-only detection runs on raw content before rendering — no change needed
|
||
- Compose box stays plain textarea for v1; no preview toolbar required
|
||
|
||
### Effort estimate
|
||
| Scope | Estimate |
|
||
|---|---|
|
||
| Inline-only (bold, italic, code, strikethrough) | ~1.5 hours |
|
||
| Full markdown (+ block elements, CSS for bubbles) | ~4–5 hours |
|