discourse/plugins/discourse-solved/lib/discourse_solved
Régis Hanol db1c8a0634
UX: Preserve formatting in solution excerpts (#36552)
Previously, solution excerpts shown in the OP used PrettyText.excerpt()
which stripped all HTML formatting - code blocks, images, quotes, and
other rich content were reduced to plain text, making technical
solutions difficult to read.

Now the full cooked content is sent to the client, preserving all
formatting. The excerpt is displayed in a collapsed state by default
with a max-height and gradient fade, expandable via toggle. This keeps
the UI compact while allowing users to see properly formatted solutions.

Changes:
- Use answer_post.cooked instead of PrettyText.excerpt() in
topic_extension.rb
- Rewrite SolvedAcceptedAnswer component with self-contained
expand/collapse
- Add CSS for collapsed state (max-height: 300px with gradient overlay)
- Add system specs for code block and image preservation

**BEFORE**

<img width="1488" height="1284" alt="BEFORE"
src="https://github.com/user-attachments/assets/ec9e5932-62bb-4b6a-9a15-5efe5af2881c"
/>

**AFTER**

<img width="1488" height="1284" alt="AFTER"
src="https://github.com/user-attachments/assets/845bcd66-8abf-445c-9d76-cfbaa6e436a0"
/>

Internal ref - t/168315
2025-12-11 15:23:10 +01:00
..
accepted_answer_cache.rb DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
before_head_close.rb
category_extension.rb DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
engine.rb DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
first_accepted_post_solution_validator.rb
guardian_extensions.rb DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
post_serializer_extension.rb
queries.rb DEV: refactor user card/summary accepted answer's query (#35500) 2025-10-31 08:49:36 +01:00
register_filters.rb DEV: Hand-pick Rails/WhereNot autofixes (#35117) 2025-10-03 13:29:22 +02:00
topic_extension.rb UX: Preserve formatting in solution excerpts (#36552) 2025-12-11 15:23:10 +01:00
topic_posters_summary_extension.rb
topic_view_serializer_extension.rb
user_summary_extension.rb DEV: refactor user card/summary accepted answer's query (#35500) 2025-10-31 08:49:36 +01:00
web_hook_extension.rb