json-highlight
Version:
A Json to Html formatter
43 lines (37 loc) • 826 B
Markdown
# json-highlight
[](https://npmjs.org/package/json-highlight)
> A Json to Html formatter, [Live Demo](https://bowencool.github.io/json-highlight/)
## Install
- using npm
``` bash
npm i json-highlight
```
- using in browser
``` html
<script scr="//unpkg.com/json-highlight"></script>
<!-- or -->
<script scr="//cdn.jsdelivr.net/npm/json-highlight"></script>
```
## Usage
``` js
document.querySelector('pre').innerHTML = jsonHighlight({
number: 123,
string: 'hello',
array: [
2e60,
-0.2,
null,
true,
{
nesting: [],
},
],
});
```
## Todos:
- [ ] 可配置内联颜色
- [ ] 可配置类名前缀
- [ ] 全局配置
- [ ] cli接口
## Particular Thanks
- [luyilin/json-format-highlight](https://github.com/luyilin/json-format-highlight)