StackExchange / StackExchange/Stacks-Editor
bug(editor) Text originating from a code editor will be pasted in as code, even if is definitely not code
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 437
- Forks
- 61
- Avg merge
- 16h 2m
- Merged PRs (30d)
- 8
Description
Describe the bug
Any text that is copied from a code editor (including VS, VS Code, and even revisions/source in the browser) is pasted into both MD and RT as a fenced code block. This happens even if the text in question has no markdown at all (though really, the presence of markdown should not cause this).
To Reproduce
Steps to reproduce the behavior:
- Go to revisions/source for the MSE post and copy out any text. The 4th paragraph has no markdown.
- Go to the stacks editor, paste it in
- Note: is a fenced code block if pasted into either mode
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots

Desktop (please complete the following information):
Windows 11 Chrome 103
Additional context
https://meta.stackexchange.com/a/380334/51
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
Start by reproducing the paste behavior in the Stacks editor using text copied from the linked revisions/source page, in both Markdown and Rich Text modes. Trace the editor's paste handling and verify that plain text is not converted to a fenced code block; confirm the behavior with text containing and lacking Markdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100