/mobiledoc-renderer-elixir

MobileDoc HTML Renderer for Elixir

Primary LanguageElixirMIT LicenseMIT

MobileDoc HTML Renderer for Elixir

(WIP)

Similarly to MobileDoc HTML Renderer, this an HTML renderer for the MobileDoc format used by the ContentKit editor, written in Elixir.

Installation

First, add MobileDoc to your mix.exs dependencies:

def deps do
  [{:mobiledoc, ">= 0.0.1"}]
end

Then, update your dependencies:

$ mix deps.get

Usage

mobiledoc = Poison.decode!(~s(
  {
    "version": "0.2.0",
    "sections": [
      [
        ["B"]
      ],
      [
        [1, "P", [
          [[0], 0, "hello world"]
        ]]
      ]
    ]
  }
))

rendered = MobileDoc.Renderer.render(mobiledoc)
# renders <div><p><b>hello world</b></b></div>