Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
Writing a custom converter to handle non-html tags

When CKEditor5 sees bad HTML like this:

  @foreach ($data as $datum)
    <div>
      <span>{{ $datum }}</span>
    </div>
  @endforeach

It will wrap the tags in 'p' so it turns out looking like this:

<p>
    @foreach ($data as $datum)
</p>
<div>
    <span>{{ $datum }}</span>
</div>
<p>
    @endforeach
</p>

I believe it should be possible to prevent that from happening with a custom converter plugin or even in the config by messing with the model writer. Or do I need to hack it during the upcasting stage, which I'd be willing to do. What should I look at to start with this? Thanks.

I think I would start by getting the data model to not see it as "paragraph".

If it's not possible, how do I change the paragraph to something else? Using a different tag would work for me.

I also need it to work in tables as well. This just gets deleted:

<table>
    <tbody>
        <tr>
            <td>
                foo
            </td>
        </tr>
  @foreach ($data as $datum)
        <tr>
            <td>
                {{ $datum }}
            </td>
        </tr>
  @endforeach
        <tr>
            <td>
                bar
            </td>
        </tr>
    </tbody>
</table>

How do I make this not be deleted?

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!