[#562] Markdown rendering for story content + Write/Preview toggle#571
[#562] Markdown rendering for story content + Write/Preview toggle#571realproject7 merged 3 commits intomainfrom
Conversation
- Add react-markdown + rehype-sanitize dependencies - Create StoryContent component with fiction-focused sanitization (bold, italic, headings, blockquotes, scene breaks, lists, inline code) - Strip raw HTML/scripts/iframes/images/tables for XSS prevention - Style Markdown to match PlotLink's moleskine prose aesthetic (Lora font, scene breaks as "* * *", blockquote with accent border) - Replace plain text rendering on story page and plot detail page - Add Write/Preview toggle on Create Storyline and Chain Plot forms - Plain text stories still render correctly (valid Markdown) Fixes #562 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
T2b approves. rehype-sanitize with restricted tagNames and empty attributes provides solid XSS prevention. StoryContent component cleanly shared between display and preview. Write/Preview toggle is clean with proper type="button" to prevent form submission. Prose CSS matches the moleskine aesthetic. Minor: WritePreviewToggle accepts a content prop that is unused — consider removing it to avoid confusion (non-blocking).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The renderer and preview toggle are close, but the current Markdown setup still misses one required syntax and regresses existing plain-text formatting.
Findings
- [high]
StoryContentswitched story pages away fromwhitespace-pre-wrap, but the new Markdown renderer does not preserve soft line breaks. Plain-text stories that rely on single newlines now collapse those breaks into spaces, which violates the ticket's requirement that existing plain-text stories keep rendering correctly.- File:
src/components/StoryContent.tsx:38 - Suggestion: preserve single-line breaks for legacy/plain-text content, for example by enabling a breaks plugin or otherwise restoring
pre-wrap-equivalent behavior where Markdown should still render naturally.
- File:
- [medium] The issue explicitly requires strikethrough support, but this implementation never enables GFM parsing, so
~~text~~remains literal text instead of rendering as<del>.- File:
src/components/StoryContent.tsx:38 - File:
package.json:28 - Suggestion: add
remark-gfm(or equivalent) for parsing strikethrough, then continue blocking unsupported elements such as tables/images at the render/sanitize layer.
- File:
Decision
Requesting changes because the PR does not yet meet the required Markdown syntax support and currently regresses existing plain-text story formatting.
… breaks - remark-gfm enables GFM parsing so ~~strikethrough~~ renders as <del> - remark-breaks preserves single newlines as <br> so existing plain-text stories don't collapse line breaks into spaces Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The remaining Markdown gaps are fixed. The renderer now preserves soft line breaks for existing plain-text stories and enables the required strikethrough syntax, while keeping the existing sanitization path in place.
Findings
- None.
Decision
Approving because the Markdown rendering and Write/Preview toggle now satisfy the Batch 25 / #562 requirements without the earlier plain-text formatting regression.
Summary
Fixes #562
Test plan
---scene breaks)<script>alert(1)</script>)npm run build)🤖 Generated with Claude Code