Skip to content

Commit

Permalink
docs(xml): write a section on common pitfalls
Browse files Browse the repository at this point in the history
It's considerably too long, but oh well.
More docs are better than less, I guess.
  • Loading branch information
lishaduck committed Jun 9, 2024
1 parent e4abb3f commit 27cdcd5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions xml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,22 @@ Note that while you can _theoretically_ use internal API properties, currently,
Supporting `~children` might be added in the future ([#57](https://github.com/lowlighter/libs/issues/57)) for mixed content, but its behavior is not yet well defined.
Setting `~name` manually might lead to unexpected behaviors, especially if it differs from the parent key.

> [!TIP]
> For more type-safety, write `satisfies xml_document` after whatever you pass into `stringify`, like so:
>
> <!-- TODO(lishaduck): Add ts highlighting once denoland/deno#24164 is resolved -->
>
> ```
> import { stringify, type xml_document } from "./stringify.ts"
>
> const ast = {
> "@version": "1.0",
> "@encoding": "UTF-8",
> "root": {},
> } satisfies xml_document
> const result = stringify(ast)
> ```
## 📜 License and credits

```plaintext
Expand Down

0 comments on commit 27cdcd5

Please sign in to comment.