https://github.com/moonbit-community/prettyprinter
Pretty printer engine for MoonBit
https://github.com/moonbit-community/prettyprinter
moonbit pretty-printer
Last synced: 4 months ago
JSON representation
Pretty printer engine for MoonBit
- Host: GitHub
- URL: https://github.com/moonbit-community/prettyprinter
- Owner: moonbit-community
- Created: 2024-07-21T07:54:07.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-12T05:41:31.000Z (6 months ago)
- Last Synced: 2025-12-13T14:28:06.946Z (6 months ago)
- Topics: moonbit, pretty-printer
- Language: MoonBit
- Homepage:
- Size: 78.1 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pretty printer
A declarative-style pretty printer engine, which includes printers for built-in
types such as `Array`, `Map`, and `Json`.
# Usage
## Print Value
Use `render` to pretty print any type implemented `Pretty` trait.
```moonbit
let map = {
"name": ["John", "Mike"], "age": ["15","18"], "id": ["11109121","2000012312"]
}
map |> @prettyprinter.render() |> println()
```
output:
```
{
"name": ["John", "Mike"],
"age": ["15", "18"],
"id": ["11109121", "2000012312"]
}
```
## Implement Pretty Trait
Write declarative code to implement a printer for your type.
See example in package `prettyprinter/example`.