-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Code block: add language support to retain language information when pasting markdown #10200
Copy link
Copy link
Open
Labels
[Block] CodeAffects the Code BlockAffects the Code Block[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
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:
- Open Gutenberg editor
- Paste code like
```php
<?php
$random = 'what';
```- 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Block] CodeAffects the Code BlockAffects the Code Block[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.