Add web client Markdown rendering support#241
Conversation
|
Reviewed and tested locally — schema regeneration is stable, packet schema tests pass, marked produces correct HTML on a sample doc, and the flow matches the desktop client (
None are blocking — happy to merge as-is if you'd rather land the fix and tidy in a follow-up. |
|
All mentioned issues have been fixed now |
Analysis & TestingTests run locally:
Findings:
Looks good:
Not verified here: live browser render of a help document (needs manual testing per the PR description). |
|
Done, fixed issues 1 to 3. The fixes done should help in making the rules document gets focused with a screen reader better which eliminates the 1 second wait before the document loads up for the screen reader on the web client. |
Summary
This PR introduces native-vendored Markdown rendering for the web client to properly display help documents and formatted texts. Previously, the web client ignores the packet because of my previous merged PR which implemented markdown rendering for the desktop client.
The cause is that in the server side in pr #235 I had to add a flag that indicates markdown content and the web client didn't know what to do with it so it broke all kinds of edit boxes.
Now, web client has markdown support, and other edit boxes work again.
Key Changes
marked.min.jsandpurify.min.jsdirectly intoclients/web/libs/to guarantee a self-contained, offline-compatible environment without relying on external CDNs.<dialog id="markdown-viewer-dialog">component andmarkdown_viewer.jsmodule. It safely parses raw markdown strings and aggressively sanitizes the output with DOMPurify to eliminate XSS vectors.request_inputhandler withinapp.jsto automatically utilize.show()on the new viewer whencontent_format="markdown"..markdown-bodyelements, rendering tables, code segments, blockquotes, and headings seamlessly across dark and light OS themes. Link targeting was mapped to open in new blank tabs, improving UX.server/tools/export_packet_schema.pyto target the web client appropriately and regenerated the cross-repository schemas, eliminating strict validation errors for the newercontent_formatfield.Testing Notes