Issue #677💬 AnsweredOpened December 23, 2017by mingodad0 reactions

Escape html

快速解答by artf

As already mentioned here we have to create a new Component for <pre> as escaping everything it's not an option

Read full answer below ↓

Question

Hello ! I noticed several faults in escaping html through grapesjs some of it can be fixed by this pull request https://github.com/artf/grapesjs/pull/676 , but I still having problems with the html inserted on start.

In the example bellow the first <pre> is not rendered properly and I need to double escape it like on the second <pre> to get it properly rendered and be able to import/export after that properly.

Somehow between the several transformations applied to the initial html it get screwed.

			<div class="buttons">
				<h1>Buttons</h1>
				<a class="btn smooth btn-a">btn-a</a>
			
				<br><br><pre>&lt;a class="btn btn-b smooth"&gt;btn-b&lt;/a&gt;</pre>
				<br>
				<a class="btn smooth btn-a btn-sm">btn-sm btn-a</a>
				
				<br><br><pre>&amp;lt;a class="btn btn-b btn-sm smooth"&amp;gt;btn-sm&amp;lt;/a&amp;gt;</pre>
			</div>

Answers (2)

artfDecember 27, 2017

As already mentioned here we have to create a new Component for <pre> as escaping everything it's not an option

lock[bot]September 17, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.