Skip to content

Commit 65b1912

Browse files
authored
Add a note about getting a string output
1 parent 73874d6 commit 65b1912

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ Output:
6161
</body>
6262
```
6363

64+
> [!NOTE]
65+
> `cssToHtml` always returns an [`HTMLBodyElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement). To get the string representation of the generated HTML, use [`outerHtml`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML). For example:
66+
>
67+
> Input:
68+
> ```javascript
69+
> const html = await cssToHtml('h1#greeting { content: "Hello!"; }');
70+
> console.log( html.outerHtml );
71+
> ```
72+
>
73+
> Output:
74+
> ```javascript
75+
> '<h1 id="greeting">Hello!</h1>'
76+
> ```
77+
6478
6579
## Options
6680

0 commit comments

Comments
 (0)