Skip to content

courajs/mobiledoc-pretty-json-renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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));

About

A pretty-printer for mobiledoc documents

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published