|
| 1 | +--- |
| 2 | +id: 8858 |
| 3 | +title: 'Markdown component: Exclude code blocks from ticket ID linking' |
| 4 | +state: CLOSED |
| 5 | +labels: |
| 6 | + - bug |
| 7 | + - ai |
| 8 | +assignees: |
| 9 | + - tobiu |
| 10 | +createdAt: '2026-01-21T23:14:38Z' |
| 11 | +updatedAt: '2026-01-21T23:15:41Z' |
| 12 | +githubUrl: 'https://github.com/neomjs/neo/issues/8858' |
| 13 | +author: tobiu |
| 14 | +commentsCount: 1 |
| 15 | +parentIssue: null |
| 16 | +subIssues: [] |
| 17 | +subIssuesCompleted: 0 |
| 18 | +subIssuesTotal: 0 |
| 19 | +blockedBy: [] |
| 20 | +blocking: [] |
| 21 | +closedAt: '2026-01-21T23:15:41Z' |
| 22 | +--- |
| 23 | +# Markdown component: Exclude code blocks from ticket ID linking |
| 24 | + |
| 25 | +The current `replaceTicketIds` logic in `Neo.component.Markdown` aggressively replaces `#123` patterns inside code blocks (fenced and inline) with HTML links. This corrupts code examples, especially CSS hex codes or comments containing hashes. |
| 26 | + |
| 27 | +We need to update the `modifyMarkdown` method to: |
| 28 | +1. Temporarily mask fenced code blocks. |
| 29 | +2. Temporarily mask inline code blocks. |
| 30 | +3. Perform the ticket ID replacement. |
| 31 | +4. Restore the masked blocks. |
| 32 | + |
| 33 | +This ensures that only ticket references in the prose text are linked. |
| 34 | + |
| 35 | +## Timeline |
| 36 | + |
| 37 | +- 2026-01-21T23:14:40Z @tobiu added the `bug` label |
| 38 | +- 2026-01-21T23:14:40Z @tobiu added the `ai` label |
| 39 | +- 2026-01-21T23:14:58Z @tobiu referenced in commit `5313b09` - "fix(Markdown): Exclude code blocks from ticket ID linking (#8858)" |
| 40 | +- 2026-01-21T23:15:09Z @tobiu assigned to @tobiu |
| 41 | +### @tobiu - 2026-01-21T23:15:24Z |
| 42 | + |
| 43 | +**Input from Gemini 3 Pro:** |
| 44 | + |
| 45 | +> ✦ I have implemented the fix by introducing a masking step in `modifyMarkdown`. |
| 46 | +> 1. Fenced code blocks (` ```...``` `) are replaced with `__NEO_CODE_BLOCK_X__`. |
| 47 | +> 2. Inline code blocks (` `...` `) are replaced with `__NEO_INLINE_CODE_X__`. |
| 48 | +> 3. Ticket replacement runs on the masked text. |
| 49 | +> 4. The masked tokens are replaced back with the original code. |
| 50 | +> |
| 51 | +> This prevents `#123` inside code blocks (like CSS hex colors or comments) from being turned into links. |
| 52 | +> Changes pushed to `dev` in commit `5313b0968`. |
| 53 | +
|
| 54 | +- 2026-01-21T23:15:42Z @tobiu closed this issue |
| 55 | + |
0 commit comments