{"id":19370052,"url":"https://github.com/bustle/mobiledoc-html-renderer","last_synced_at":"2026-03-11T13:17:12.782Z","repository":{"id":34849152,"uuid":"38842867","full_name":"bustle/mobiledoc-html-renderer","owner":"bustle","description":"Deprecated. See https://github.com/bustlelabs/mobiledoc-dom-renderer#rendering-html","archived":false,"fork":false,"pushed_at":"2016-11-16T19:41:57.000Z","size":55,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-02-17T22:40:35.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bustle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-09T20:13:16.000Z","updated_at":"2017-01-30T22:40:12.000Z","dependencies_parsed_at":"2022-08-26T18:22:00.617Z","dependency_job_id":null,"html_url":"https://github.com/bustle/mobiledoc-html-renderer","commit_stats":null,"previous_names":["bustlelabs/mobiledoc-html-renderer"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/bustle/mobiledoc-html-renderer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bustle%2Fmobiledoc-html-renderer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bustle%2Fmobiledoc-html-renderer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bustle%2Fmobiledoc-html-renderer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bustle%2Fmobiledoc-html-renderer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bustle","download_url":"https://codeload.github.com/bustle/mobiledoc-html-renderer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bustle%2Fmobiledoc-html-renderer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T08:14:05.052Z","updated_at":"2026-03-11T13:17:12.764Z","avatar_url":"https://github.com/bustle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Mobiledoc HTML Renderer [![Build Status](https://travis-ci.org/bustlelabs/mobiledoc-html-renderer.svg?branch=master)](https://travis-ci.org/bustlelabs/mobiledoc-html-renderer)\n\n**This package is deprecated and will not be updated. Please see [Rendering HTML](https://github.com/bustlelabs/mobiledoc-dom-renderer#rendering-html) on the mobiledoc-dom-renderer `README.md` for a supported path to render Mobiledoc as HTML.**\n\nThis is an HTML renderer for the [Mobiledoc format](https://github.com/bustlelabs/mobiledoc-kit/blob/master/MOBILEDOC.md) used\nby [Mobiledoc-Kit](https://github.com/bustlelabs/mobiledoc-kit).\n\nTo learn more about Mobiledoc cards and renderers, see the **[Mobiledoc Cards docs](https://github.com/bustlelabs/mobiledoc-kit/blob/master/CARDS.md)**.\n\nThe renderer is a small library intended for use in servers that are building\nHTML documents. It may be of limited use inside browsers as well.\n\n### Usage\n\n```\nvar mobiledoc = {\n  version: \"0.2.0\",\n  sections: [\n    [         // markers\n      ['B']\n    ],\n    [         // sections\n      [1, 'P', [ // array of markups\n        // markup\n        [\n          [0],          // open markers (by index)\n          0,            // close count\n          'hello world'\n        ]\n      ]\n    ]\n  ]\n};\nvar renderer = new HTMLRenderer({cards: []});\nvar rendered = renderer.render(mobiledoc);\nconsole.log(rendererd.result); // \"\u003cdiv\u003e\u003cp\u003e\u003cb\u003ehello world\u003c/b\u003e\u003c/p\u003e\u003c/div\u003e\"\n```\nThe Renderer constructor accepts a single object with the following optional properties:\n  * `cards` [array] - The list of card objects that the renderer may encounter in the mobiledoc\n  * `cardOptions` [object] - Options to pass to cards when they are rendered\n  * `unknownCardHandler` [function] - Will be called when any unknown card is enountered\n  * `unknownAtomHandler` [function] - Will be called when any unknown atom is enountered\n  * `sectionElementRenderer` [object] - A map of hooks for section element rendering.\n    * Valid keys are P, H1, H2, H3, BLOCKQUOTE, PULL-QUOTE\n    * A valid value is a function that returns an element\n\nThe return value from `renderer.render(mobiledoc)` is an object with two properties:\n  * `result` [string] - The rendered result\n  * `teardown` [function] - When called, this function will tear down the rendered mobiledoc and call any teardown handlers that were registered by cards when they were rendered\n\n#### sectionElementRenderer\n\nUse this renderer option to customize what element is used when rendering\na section.\n\n```\nvar renderer = new MobiledocHTMLRenderer({\n  sectionElementRenderer: {\n    P: function() { return document.createElement('span'); },\n    H1: function() { return document.createElement('h2'); },\n    H2: function() {\n      var element = document.createElement('h2');\n      element.setAttribute('class', 'subheadline');\n      return element;\n    }\n    /* Valid keys are P, H1, H2, H3, BLOCKQUOTE, PULL-QUOTE */\n  }\n});\nvar rendered = renderer.render(mobiledoc);\n```\n\n### Tests\n\nCommand-line:\n\n * `npm test`\n\nOr in the browser:\n\n * `broccoli serve`\n * visit http://localhost:4200/tests\n\n### Releasing\n\n* `npm version patch` or `minor` or `major`\n* `npm run build`\n* `git push bustle --tags`\n* `npm publish`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbustle%2Fmobiledoc-html-renderer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbustle%2Fmobiledoc-html-renderer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbustle%2Fmobiledoc-html-renderer/lists"}