How Do I Output HTML Instead of XHTML Code Using CKEditor?

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(Article contents added)
 
(Minor formatting changes)
 
Line 2: Line 2:
 
If you want CKEditor to output valid HTML4 code instead of XHTML, you should configure the behavior of the <code>[http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#dataProcessor dataProcessor]</code>.
 
If you want CKEditor to output valid HTML4 code instead of XHTML, you should configure the behavior of the <code>[http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#dataProcessor dataProcessor]</code>.
  
For some tips on how to achieve this, check the [[CKEditor 3.x/Developers Guide/Output Formatting|Output Formatting]] section of [[CKEditor 3.x/Developers Guide|CKEditor 3.x Developer's Guide]] as well as the "Output HTML" (<code>output_html.html</code>) and "Output XHTML" (<code>output_xhtml.html</code>) samples that can be found in the <code>_samples</code> directory of CKEditor installation package.
+
For some tips on how to achieve this, check the [[CKEditor 3.x/Developers Guide/Output Formatting|Output Formatting]] section of [[CKEditor 3.x/Developers Guide|CKEditor 3.x Developer's Guide]] as well as the '''Output HTML''' (<code>output_html.html</code>) and '''Output XHTML''' (<code>output_xhtml.html</code>) samples that can be found in the <code>_samples</code> directory of CKEditor installation package.
  
 
If, for example, you want CKEditor to output the self-closing tags in the HTML4 way, creating <code><nowiki><br></nowiki></code> elements instead of <code><nowiki><br /></nowiki></code>, configure the <code>selfClosingEnd</code> setting in the following way.
 
If, for example, you want CKEditor to output the self-closing tags in the HTML4 way, creating <code><nowiki><br></nowiki></code> elements instead of <code><nowiki><br /></nowiki></code>, configure the <code>selfClosingEnd</code> setting in the following way.

Latest revision as of 13:34, 7 March 2011

If you want CKEditor to output valid HTML4 code instead of XHTML, you should configure the behavior of the dataProcessor.

For some tips on how to achieve this, check the Output Formatting section of CKEditor 3.x Developer's Guide as well as the Output HTML (output_html.html) and Output XHTML (output_xhtml.html) samples that can be found in the _samples directory of CKEditor installation package.

If, for example, you want CKEditor to output the self-closing tags in the HTML4 way, creating <br> elements instead of <br />, configure the selfClosingEnd setting in the following way.

CKEDITOR.on( 'instanceReady', function( ev )
    {
        ev.editor.dataProcessor.writer.selfClosingEnd = '>';
    });
This page was last edited on 7 March 2011, at 13:34.