Issue #5724πŸ’¬ AnsweredOpened Mar 8, 2024by bernesto0 reactions

Whitespace handling in inline elements

Quick answerby danstarns

Closing in favor of merged commit. https://github.com/GrapesJS/grapesjs/pull/5719

Read full answer below ↓

Question

GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome v122Reproducible demo link https://jsfiddle.net/zwo0mdqf/5/Describe the bug How to reproduce the bug?Create valid inline block elements such as span, b, i, em, etc. that use multiple space, tab(s), or line breaks as word separators. What is the expected behavior? These elements when rendered should be spaced apart by one space. HTML export whitespace should respect input whitespace. What is the current behavior? These elements are rendered in the editor as separate components, but appear as o...

Answers (2)

GJS Helperβ€’ May 17, 2026

The issue you're encountering with whitespace handling in GrapesJS, specifically with inline elements and the getHtml() output, stems from how HTML parsers and GrapesJS's component model treat different types of whitespace. Root Cause HTML Whitespace Collapsing: By default, HTML collapses multiple...

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.