mobiledoc-pretty-json-renderer
v2.0.1
Published
A pretty-printer for mobiledoc documents
Downloads
6
Maintainers
Readme
mobiledoc-pretty-json-renderer
A pretty JSON formatter for Mobiledoc documents.
Because of all the nested arrays, a dumb JSON pretty-printer gives something pretty difficult to read:
{
"version": "0.3.0",
"atoms": [],
"markups": [],
"cards": [],
"sections": [
[
1,
"H2",
[
[
0,
[],
0,
"Hello World"
]
]
],
[
1,
"p",
[
[
0,
[],
0,
"This is Mobiledoc-kit."
]
]
]
]
}
This formatter produces a nicer structure:
{
"version": "0.3.0",
"markups": [],
"atoms": [],
"cards": [],
"sections": [
[1, "H2", [
[0, [], 0, "Hello World"]
]],
[1, "p", [
[0, [], 0, "This is Mobiledoc-kit."]
]]
]
}
Usage
npm install -S mobiledoc-pretty-json-renderer
var formatMobiledoc = require('mobiledoc-pretty-json-renderer');
console.log(formatMobiledoc(someMobiledoc));