Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set code block language when pasting into editor #215

Merged
merged 2 commits into from
Jun 7, 2021

Conversation

donnapep
Copy link
Contributor

@donnapep donnapep commented Jun 3, 2021

Fixes #125.

Changes proposed in this Pull Request

Adds support for language when pasting code into the block editor.

Testing instructions

Test with the following snippets and ensure the language in the block toolbar is set appropriately. The starting and ending backticks, as well as the language, should not appear as part of the code block content:

```python
call_function()

if some_condition:
    do_something()
```

And:

```css
#button {
  border: none;
}
```

Also test without the language parameter. The backticks should still be removed:

```
#button {
  border: none;
}
```

@donnapep donnapep self-assigned this Jun 3, 2021
@donnapep donnapep requested a review from yscik June 3, 2021 15:29
@donnapep donnapep added this to the 3.6.1 milestone Jun 3, 2021
Copy link
Contributor

@yscik yscik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good & works well, just a small issue:

src/code-block/transforms.js Outdated Show resolved Hide resolved
Co-authored-by: Peter Kiss <peter@yscik.com>
Copy link
Contributor

@yscik yscik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@donnapep donnapep merged commit 3b268ab into master Jun 7, 2021
@donnapep donnapep deleted the add/add-language-support-raw-transform branch June 7, 2021 18:46
@merkushin merkushin mentioned this pull request Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block Editor paste from Markdown does not include code language
2 participants