Codex repeatedly generates broken Markdown when nested code fences are requested
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of the IDE extension are you using?
26.901.22334
What subscription do you have?
chatgpt pro
Which IDE are you using?
openai.chatgpt
What platform is your computer?
Windows
What issue are you seeing?
When Codex is asked to provide copy-ready Markdown containing fenced code examples, it may use the same fence length for the outer and inner blocks.
The inner fence then closes the outer block prematurely. The remaining content is rendered outside the intended Markdown block.
The issue also occurred immediately after Codex tried to correct its first broken response:
- First response: three backticks outside and inside
- Corrected response: four backticks outside and inside
- Both responses broke at the nested fence
What steps can reproduce the bug?
-
Ask Codex to output a complete document as copy-ready Markdown.
-
Require fenced code examples inside the document.
-
Example prompt:
Give me the complete text as Markdown. Include PowerShell and text code blocks. -
Codex wraps the document in a fenced block.
-
Codex uses an inner fence of the same length.
-
The outer block ends prematurely.
What is the expected behavior?
Codex should generate valid, copy-ready Markdown.
It should ensure that the outer fence is longer than every fence contained in the document. Alternatively, it could use tildes for the outer fence:
~~~~md
```powershell
$env:DEBUG
Additional information
Environment:
- Windows
- Visual Studio Code
- Extension ID:
openai.chatgpt - Extension version:
26.901.22334
The Markdown renderer appears to behave correctly. The generated delimiter structure itself is invalid.
Impact:
- Broken rendering
- Content cannot be copied as one Markdown block
- Manual correction is required
- The attempted correction can reproduce the same mistake with a longer fence
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or failing test is identified in the report. Start by reproducing the issue with the supplied prompt and locating the Markdown-generation path; done means nested fenced examples remain inside one valid, copy-ready outer block, including after a correction request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100