How to use the mobiledoc-kit/renderers/mobiledoc.render function in mobiledoc-kit

To help you get started, we’ve selected a few mobiledoc-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bustle / mobiledoc-kit / tests / helpers / mobiledoc.js View on Github external
function build(treeFn, version) {
  let post = PostAbstractHelpers.build(treeFn);
  switch (version) {
    case MOBILEDOC_VERSION_0_2:
      return MobiledocRenderer_0_2.render(post);
    case MOBILEDOC_VERSION_0_3:
      return MobiledocRenderer_0_3.render(post);
    case MOBILEDOC_VERSION_0_3_1:
      return MobiledocRenderer_0_3_1.render(post);
    case MOBILEDOC_VERSION_0_3_2:
      return MobiledocRenderer_0_3_2.render(post);
    case undefined:
    case null:
      return mobiledocRenderers.render(post);
    default:
      throw new Error(`Unknown version of mobiledoc renderer requested: ${version}`);
  }
}
github bustle / mobiledoc-kit / tests / helpers / assertions.js View on Github external
QUnit.assert.postIsSimilar = function(post, expected, postName='post') {
    comparePostNode(post, expected, this, postName, true);
    let mobiledoc         = mobiledocRenderers.render(post),
        expectedMobiledoc = mobiledocRenderers.render(expected);
    this.deepEqual(mobiledoc, expectedMobiledoc,
                   `${postName} is similar to expected`);
  };
github bustle / mobiledoc-kit / tests / helpers / assertions.js View on Github external
QUnit.assert.postIsSimilar = function(post, expected, postName='post') {
    comparePostNode(post, expected, this, postName, true);
    let mobiledoc         = mobiledocRenderers.render(post),
        expectedMobiledoc = mobiledocRenderers.render(expected);
    this.deepEqual(mobiledoc, expectedMobiledoc,
                   `${postName} is similar to expected`);
  };
github bustle / mobiledoc-kit / tests / helpers / mobiledoc.js View on Github external
function renderPostInto(element, post, editorOptions={}) {
  let mobiledoc = mobiledocRenderers.render(post);
  mergeWithOptions(editorOptions, {mobiledoc});
  let editor = new Editor(editorOptions);
  editor.render(element);
  return editor;
}