Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Code block: add language support to retain language information when pasting markdown | GoodFirstPicks

Code block: add language support to retain language information when pasting markdown

WordPress/gutenberg 4 comments 13d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeWordPressJavaScriptReact

Why this is a good first issue

Adding language support to code blocks requires understanding Markdown parsing and block attributes.

AI Summary

The issue requests adding language support to code blocks in Gutenberg, specifically retaining language information when pasting Markdown. This involves modifying the code block to include language attributes and classes. The main blocker is the current lack of language support in the code block.

Issue Description

Describe the bug When I paste markdown, I like/expect that the language specified after the start of a backtick fence will be converted into a CSS class about the language specified. So if I start the block like ```php I expect to see a <code class="language-php"> in the block. This isn't happening.

Here's a CommonMark spec/test about the behavior that matches my expectations: https://spec.commonmark.org/0.28/#example-111

To Reproduce Steps to reproduce the behavior:

  1. Open Gutenberg editor
  2. Paste code like
```php
<?php

$random = 'what';
```
  1. See that there is not a "language-php" class applied to that code block by default.

Expected behavior That the language-php or similar is honored and applied as a class to either the internal code block (like the CommonMark spec) or even to the outer pre block.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Firefox
  • Version 62.0.2

Additional context

  • Noticed while using Gutenberg 3.9
  • I know there are lots of "dialects" of Markdown. And I'm confident that both the CommonMark standard and "GitHub Flavored Markdown" (link about that) specify the behavior described above.

GitHub Labels

[Type] Enhancement[Feature] Blocks[Status] In Progress[Block] Code

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • requires understanding of Markdown parsing
  • potential impact on existing code blocks
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno
Assigneecarolinan