Add markdown rendering support for slide text#280
Conversation
Adds *italic*, **bold**, _underline_, and `code` to the rendered text, with backslash-escapes for literal markers. Input is HTML-escaped before markdown processing so script/HTML in the ?text= URL parameter cannot execute.
|
Claude finished @simonw's task —— View job Code Review Complete ✅I've thoroughly reviewed this PR that adds inline markdown rendering support to the big-words.html application. Here's my comprehensive feedback: Todo List:
🟢 Strengths
🟡 Areas for Improvement1. Regex Edge Cases & Robustness (
|
|
Bold doesn't work because slide titles are bold already. I'll tolerate that bug for the moment. |
Summary
This PR adds inline markdown rendering capabilities to the slide text display, allowing users to format text with bold, italic, underline, and code styling.
Key Changes
white-space: pre-wrapCSS property from the text styling to allow proper text wrapping with the new markdown renderingescapeHtml()function to safely escape HTML special characters in user input before processingrenderInlineMarkdown()function that processes inline markdown syntax:**text**for bold (<strong>)*text*for italic (<em>)_text_for underline (<u>)`text`for code (<code>)\*,\_, etc.)renderMarkdown()function that splits text by newlines and applies inline markdown rendering to each line, joining them with<br>tagsapplyFromState()to useinnerHTMLwith the new markdown renderer instead oftextContent, enabling formatted text displayImplementation Details
The markdown rendering uses a token stashing approach with a Unicode sentinel character (U+E000) to safely handle escaped characters and code blocks without interference from subsequent regex replacements. This ensures that content within code blocks and escaped characters are preserved exactly as intended.
https://claude.ai/code/session_01A6bDUnVTwZZ5D7gZPmb1Xo