feat(markdown): spoiler text - ||text|| renders click-to-reveal (LC-290) #323
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-290-spoiler-markdown"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds Discord/GitHub-style spoiler markdown.
||text||renders as a filled box whose content is hidden until the reader reveals it by clicking it (or focusing it and pressing Enter/Space). Reveal is one-way per element.Changes
server/src/views/markdown.rs:render_with_spoilersruns on non-code, non-link text runs and wraps each||...||pair as<span class="lc-spoiler" data-lc-spoiler tabindex="0"><span class="lc-spoiler-inner">...</span></span>. Inner text and surrounding segments still flow through the math/mention/emoji/link pipeline.||inside inline code or code blocks stays literal (code never reaches the text branch). An unterminated||is emitted literally. A no-||fast path keeps untouched bodies byte-identical (LC-77 golden fixtures unchanged).server/assets/main.css:.lc-spoilerfilled box (recolors with the active theme),.lc-spoiler-innertransparent until.lc-spoiler-revealed.server/templates/layout.html: one delegated reveal handler (click + Enter/Space), so spoilers in live-appended messages work without re-binding.No locale text is baked into the span, keeping the content-keyed markdown cache correct across locales.
Testing
just check,just fmt,just test,just test-saasall pass.||in inline code stays literal; unterminated||stays literal.||).Not operator-visible (no env/config/contract change).