Hex codes and #Hashtags incorrectly parsed and stripped as Markdown headers #69221
Open
3 of 6 tasks
Labels
[Feature] Paste
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
Hex color codes like #ffffff and hashtags used in social media (e.g., #Hashtag) are incorrectly parsed by the editor.
The expected behavior is that hex color codes and hashtags should remain intact as plain text without the # being stripped.
Investigation:
When text with # (like #ffffff) is pasted, it is first treated as a header due to the # prefix. This results in incorrect HTML (
<h1>ffffff</h1>
). Since the content is processed withinline: true
, the system later attempts to correct this by stripping the<h1>
tag, leaving only the text inside. As a result, the final output is<p>ffffff</p>
, with the # completely removed.Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Screen.Recording.2025-02-17.at.6.14.06.PM.mov
Related snippets:
This is the place where the incorrect text is generated.
gutenberg/packages/blocks/src/api/raw-handling/markdown-converter.js
Lines 45 to 49 in ad5c6c1
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: