# HTML `htmlToContent` turns HTML into paragraphs and tables, and `htmlToRuns` turns it into the content of a paragraph. They go in a document as any others do: in its sections, headers, footers, table cells and text boxes, or in a template that `patchDocument` fills. They are for HTML that comes from somewhere else, such as what people write in a rich-text editor and an app keeps, a page of a content management system, or the answer of a language model. For a document you write yourself, docx's own components say what you mean more clearly. They come with the `docx` package, from `docx/html`. In Node, they need Node.js 16.9 or later. ## Example ```ts live import { Document } from "docx"; import { htmlToContent } from "docx/html"; const doc = new Document({ sections: [ { children: htmlToContent(`
Sales were up 12%, led by EMEA.
Price list
Apples are £2 a kilo, and pears are sold out.
Prices include vat.
An indented paragraph with more space between its lines, which wraps onto a second line to show it.
`), }, ], }); ``` A unitless `line-height`, such as `1.5`, is a multiple of the font size, as in CSS, and is written as Word's line spacing of the same height. A percentage, such as `107%`, is written as that many of Word's lines, as Word writes its line spacing in HTML. ## In the document's own styles `styleMap` gives the elements that CSS selectors match the document's own styles, by their ids: paragraph styles for blocks, character styles for inline elements, and table styles for tables. It is how the HTML of an editor is written in a template's styles. `stylesheet` gives the HTML CSS of its own, such as the style sheet of the editor it comes from, as if it were in a `