UNPKG

@ckeditor/ckeditor5-utils

Version:

Miscellaneous utilities used by CKEditor 5.

20 lines (19 loc) 910 B
/** * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module utils/formathtml */ /** * A simple (and naive) HTML code formatter that returns a formatted HTML markup that can be easily * parsed by human eyes. It beautifies the HTML code by adding new lines between elements that behave like block elements * (https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements * and a few more like `tr`, `td`, and similar ones) and inserting indents for nested content. * * WARNING: This function works only on a text that does not contain any indentations or new lines. * Calling this function on the already formatted text will damage the formatting. * * @param input An HTML string to format. */ export default function formatHtml(input: string): string;