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

normalize pre tags after redactor conversion #260

Merged
merged 4 commits into from
Aug 15, 2024

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Jun 25, 2024

Description

Redactor and CKEditor use slightly different markup for code block content. Redactor wraps such content in a <pre> tag, while CKEditor requires <pre><code class="language-{langId}"> by default. This means that all <pre> tags that are not followed by a <code> tag need to be normalised to contain them.

To prevent this normalisation from interfering with custom configuration of the CKEditor code block feature, the code will only convert <pre> to <pre><code class="language-plaintext"> if the <pre> tag is not immediately followed by the <code> tag.

Original Redactor field:
Screenshot 2024-06-25 at 12 21 39

Redactor field converted to a CKEditor field before this PR:
Screenshot 2024-06-25 at 12 21 15

Redactor field converted to a CKEditor field with this PR:
Screenshot 2024-06-25 at 12 21 00

Related issues

#258

@i-just i-just requested a review from brandonkelly as a code owner June 25, 2024 11:23
@brandonkelly brandonkelly merged commit 4dda672 into 3.x Aug 15, 2024
@brandonkelly brandonkelly deleted the bugfix/258-normalize-pre-tags branch August 15, 2024 06:41
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.

2 participants