WordPress / WordPress/gutenberg
Markdown syntax is incorrectly parsed in post title field, when pasting
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 4.9k
- PR merge metrics
- PR metrics pending
Description
Description
Pasting text containing Markdown syntax (e.g. #) into the post title field results in loss of the original characters due to unintended Markdown conversion.
Step-by-step reproduction instructions
- Create a new post.
- Click into the post title field. Open the browser console
- Paste the following text:
# 3 reason why
Expected Behavior
The title field should treat input as plain text and preserve all characters exactly as pasted
Actual Behavior
The pasted text is interpreted as Markdown and converted into a heading
Console
Received HTML (pasteHandler):
<html>
<body>
<!--StartFragment--><span style="color: rgb(255, 255, 255); font-family: "Monaspace Neon", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 11.9px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: break-spaces; background-color: rgb(33, 40, 48); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"># 3 reason why</span><!--EndFragment-->
</body>
</html>
paste-handler.ts:40 Received plain text (pasteHandler):
# 3 reason why
paste-handler.ts:40 Processed HTML piece:
<h1>3 reason why</h1>
Screenshots, screen recording, code snippet
No response
Environment info
WP 7.0, default GB editor, TT5, GeneratePress
Chromium, Win 10
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
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 with paste-handler.ts and reproduce the issue by pasting the provided Markdown-like title into the post title field. Trace how the pasted plain text becomes an h1, then verify that the title preserves the # characters exactly and is no longer converted to Markdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100