Render ticket descriptions as markdown (#114) #119

Open
jared wants to merge 1 commits from fix-114-description-markdown into development
pull from: fix-114-description-markdown
Owner

Closes #114.

Problem

The ticket page showed every description as escaped plain text: renderDescriptionView() in assets/js/ticket.js used lt.escHtml(). Headings, checklists, tables, bold and code from Gandalf, MCP and manual tickets appeared as raw markdown, even though comments render markdown.

Change

  • assets/js/ticket.js: the read view now renders the description with parseMarkdown(), the same parser markdown comments use. It escapes HTML first and only allows http(s):, mailto: and relative links. The edit view still shows the raw source.
  • assets/css/ticket.css: .ticket-description-view uses white-space: normal in place of pre-wrap, as markdown comments do, so the parser's paragraphs and line breaks control the layout.
  • assets/js/markdown.js: _ and __ no longer mean emphasis inside a word (CommonMark rule). node_network_up and snake_case_name stay literal, while _italic_ and __bold__ still work. This also fixes the same problem in comments.
  • README: notes that API description is rendered as markdown and what reporters should send.

Screenshots

These were taken locally with Playwright: development on the left and this branch on the right, the same synthetic seed data on both, and Chromium at 1280px unless noted. The capture failed on any page or console error, and there were none.

1. Markdown ticket (MCP/manual style), dark. Headings, checklist, table, bold, inline and fenced code, links and a ticket reference. The last line checks that <script> and a javascript: link stay inert.

2. The same ticket, light theme

3. Gandalf alert. node_network_up stays literal.

4. hwmonDaemon box layout. This gets worse, as expected (see Merge order below).

5. Edit mode. Unchanged: it still shows the raw markdown source.

6. Markdown comment. Unchanged, apart from the underscore fix.

7. Phone (Pixel 7). The page doesn't scroll sideways; wide code blocks scroll inside their own box.

Merge order

Prod has 154 hwmonDaemon tickets drawn as a fixed-width box layout (screenshot 4). As markdown, those lose their alignment. LotusGuild/hwmonDaemon#38 switches hwmonDaemon to markdown and converts its past tickets in the database.

  • Safe now: merge this to development. Beta then shows the change, including jumbled hwmonDaemon tickets.
  • Hold: the main merge until hwmonDaemon#38 ships, or at least until its closed-ticket rewrite is done.

Checks

  • eslint: 0 errors (warnings unchanged).
  • I checked the parser in Node on underscore cases, the XSS cases and the checklist/table case.
  • I checked page width at phone size: page scrollWidth equals the viewport; the code block has overflow-x: auto.

Existing quirks I didn't change

These already show in markdown comments today:

  • In the light theme, code-block lines get the inline-code highlight.
  • A link URL containing (...) ends at the first ).

Follow-ups

  • A CI PR will add a Playwright UI job and automatic before/after screenshots for UI PRs, modelled on Pulse PRs #49 and #56. It will reuse the seed and capture scripts from this PR.
  • migrations/migrate.php fails on 001 and 003 on a fresh database: its SQL splitting breaks on their comment text. The mariadb client applies both files cleanly. CI will need this fixed, so it'll go in that PR.

🤖 Generated with Claude Code

Closes #114. ## Problem The ticket page showed every description as escaped plain text: `renderDescriptionView()` in `assets/js/ticket.js` used `lt.escHtml()`. Headings, checklists, tables, bold and code from Gandalf, MCP and manual tickets appeared as raw markdown, even though comments render markdown. ## Change - **`assets/js/ticket.js`:** the read view now renders the description with `parseMarkdown()`, the same parser markdown comments use. It escapes HTML first and only allows `http(s):`, `mailto:` and relative links. The edit view still shows the raw source. - **`assets/css/ticket.css`:** `.ticket-description-view` uses `white-space: normal` in place of `pre-wrap`, as markdown comments do, so the parser's paragraphs and line breaks control the layout. - **`assets/js/markdown.js`:** `_` and `__` no longer mean emphasis inside a word (CommonMark rule). `node_network_up` and `snake_case_name` stay literal, while `_italic_` and `__bold__` still work. This also fixes the same problem in comments. - **README:** notes that API `description` is rendered as markdown and what reporters should send. ## Screenshots These were taken locally with Playwright: `development` on the left and this branch on the right, the same synthetic seed data on both, and Chromium at 1280px unless noted. The capture failed on any page or console error, and there were none. **1. Markdown ticket (MCP/manual style), dark.** Headings, checklist, table, bold, inline and fenced code, links and a ticket reference. The last line checks that `<script>` and a `javascript:` link stay inert. ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/01-markdown-ticket-dark.png) **2. The same ticket, light theme** ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/02-markdown-ticket-light.png) **3. Gandalf alert.** `node_network_up` stays literal. ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/03-gandalf-alert-dark.png) **4. hwmonDaemon box layout.** This gets worse, as expected (see Merge order below). ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/04-hwmon-boxdraw-dark.png) **5. Edit mode.** Unchanged: it still shows the raw markdown source. ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/05-edit-mode-raw-source.png) **6. Markdown comment.** Unchanged, apart from the underscore fix. ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/06-comment-dark.png) **7. Phone (Pixel 7).** The page doesn't scroll sideways; wide code blocks scroll inside their own box. ![](https://code.lotusguild.org/LotusGuild/tinker_tickets/raw/branch/pr-119-screenshots/07-markdown-ticket-phone.png) ## Merge order Prod has 154 hwmonDaemon tickets drawn as a fixed-width box layout (screenshot 4). As markdown, those lose their alignment. LotusGuild/hwmonDaemon#38 switches hwmonDaemon to markdown and converts its past tickets in the database. - **Safe now:** merge this to `development`. Beta then shows the change, including jumbled hwmonDaemon tickets. - **Hold:** the `main` merge until hwmonDaemon#38 ships, or at least until its closed-ticket rewrite is done. ## Checks - eslint: 0 errors (warnings unchanged). - I checked the parser in Node on underscore cases, the XSS cases and the checklist/table case. - I checked page width at phone size: page scrollWidth equals the viewport; the code block has `overflow-x: auto`. ## Existing quirks I didn't change These already show in markdown comments today: - In the light theme, code-block lines get the inline-code highlight. - A link URL containing `(`...`)` ends at the first `)`. ## Follow-ups - A CI PR will add a Playwright UI job and automatic before/after screenshots for UI PRs, modelled on Pulse PRs #49 and #56. It will reuse the seed and capture scripts from this PR. - `migrations/migrate.php` fails on `001` and `003` on a fresh database: its SQL splitting breaks on their comment text. The `mariadb` client applies both files cleanly. CI will need this fixed, so it'll go in that PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-23 01:07:42 -05:00
Render ticket descriptions as markdown (#114)
Lint / JS (eslint) (push) Successful in 17s
Lint / PHP requirements (version + extensions) (push) Successful in 39s
Lint / JS (eslint) (pull_request) Successful in 33s
Lint / PHP (phpcs PSR-12) (pull_request) Successful in 1m3s
Lint / PHP requirements (version + extensions) (pull_request) Successful in 58s
Lint / Deploy (pull_request) Skipped
Lint / Notify on failure (pull_request) Skipped
Security / PHP Security (semgrep) (push) Successful in 2m52s
Security / PHP Security (semgrep) (pull_request) Successful in 3m2s
Lint / PHP (phpcs PSR-12) (push) Successful in 48s
Lint / Deploy (push) Skipped
Lint / Notify on failure (push) Skipped
fb2df0ee49
The ticket page escaped descriptions to plain text, so headings, lists,
tables, bold and code from Gandalf, MCP and manual tickets showed raw.
renderDescriptionView() now uses parseMarkdown(), the same sanitising
parser as comments, and the view drops pre-wrap for normal white space
like markdown comments do. The edit view still shows the raw source.

The parser also no longer treats underscores inside words as emphasis,
so identifiers like node_network_up stay literal (in comments too).

hwmonDaemon's fixed-width box layout loses its alignment as markdown;
LotusGuild/hwmonDaemon#38 switches it to markdown and converts its past
tickets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared referenced this issue from a commit 2026-11-23 01:07:56 -05:00
All checks were successful
Lint / JS (eslint) (push) Successful in 17s
Lint / PHP requirements (version + extensions) (push) Successful in 39s
Lint / JS (eslint) (pull_request) Successful in 33s
Lint / PHP (phpcs PSR-12) (pull_request) Successful in 1m3s
Lint / PHP requirements (version + extensions) (pull_request) Successful in 58s
Lint / Deploy (pull_request) Skipped
Lint / Notify on failure (pull_request) Skipped
Security / PHP Security (semgrep) (push) Successful in 2m52s
Security / PHP Security (semgrep) (pull_request) Successful in 3m2s
Lint / PHP (phpcs PSR-12) (push) Successful in 48s
Lint / Deploy (push) Skipped
Lint / Notify on failure (push) Skipped
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix-114-description-markdown:fix-114-description-markdown
git checkout fix-114-description-markdown
Sign in to join this conversation.