Summary
convertUrlsToLinks() temporarily replaces fenced code blocks with predictable placeholders such as __CODE_BLOCK_0__. If a user message already contains that literal text, the restore step can inject the code block HTML at the user-authored placeholder and leave the real code block placeholder behind.
Reproduction
Convert a message like:
literal __CODE_BLOCK_0__ here
```js
console.log(1)
### Current behavior
The code block can be restored into the literal `__CODE_BLOCK_0__` text, while the actual code block location is left as a placeholder.
### Expected behavior
User-authored text should remain text, and only internal placeholders generated for this conversion pass should be restored.
### Impact
Messages with placeholder-like text render incorrectly and code blocks can appear in the wrong location.
Summary
convertUrlsToLinks()temporarily replaces fenced code blocks with predictable placeholders such as__CODE_BLOCK_0__. If a user message already contains that literal text, the restore step can inject the code block HTML at the user-authored placeholder and leave the real code block placeholder behind.Reproduction
Convert a message like: