{"_id":"@contentful/rich-text-html-renderer--demo","_rev":"319-c110e1d7389b9a967ee40cfe5a54b236","name":"@contentful/rich-text-html-renderer--demo","dist-tags":{"latest":"6.0.0"},"versions":{"5.0.0":{"name":"@contentful/rich-text-html-renderer--demo","version":"5.0.0","license":"MIT","_id":"@contentful/rich-text-html-renderer--demo@5.0.0","maintainers":[{"name":"airv","email":"herve.labas@gmail.com"},{"name":"axe312","email":"roetsch.beni@googlemail.com"},{"name":"cribbles","email":"csloop@wesleyan.edu"},{"name":"danwe","email":"daniel.a.r.werner@gmail.com"},{"name":"dominik.markusic","email":"dominik.markusic@contentful.com"},{"name":"eamodeorubio","email":"eamodeorubio@gmail.com"},{"name":"elblivion","email":"anthony+nonpmspam@contentful.com"},{"name":"evcon","email":"weareninjaturtles@gmail.com"},{"name":"ewakurekmqa","email":"ewa@contentful.com"},{"name":"farruco.sanjurjo","email":"farruco.sanjurjo@gmail.com"},{"name":"felipecoe","email":"felipe@contentful.com"},{"name":"guilebarbosa","email":"guipvb@gmail.com"},{"name":"hollensteiner","email":"claushollensteiner@gmail.com"},{"name":"hungryblank","email":"hungryblank@gmail.com"},{"name":"it-internal","email":"it-internal@contentful.com"},{"name":"jakub-contentful","email":"jakub@contentful.com"},{"name":"johannes_bugiel","email":"johannes.bugiel@contentful.com"},{"name":"johanneswuerbach","email":"johannes.wuerbach@googlemail.com"},{"name":"joshuasmock","email":"f1144756@mvrht.com"},{"name":"jpawlyn","email":"jpawlyn@gmail.com"},{"name":"kgarbaya","email":"kgarbaya@gmail.com"},{"name":"lneves75","email":"luis.neves75@gmail.com"},{"name":"m10l","email":"mike.mitchell@contentful.com"},{"name":"marina-cf","email":"marina.guseva@contentful.com"},{"name":"markuslaut","email":"markus.lautenbach@contentful.com"},{"name":"martzoukos","email":"spiros@contentful.com"},{"name":"medturki","email":"mohamed@contentful.com"},{"name":"ohookins-ctf","email":"oliver@contentful.com"},{"name":"phbschmidt","email":"phoebe.schmidt@contentful.com"},{"name":"poberherr","email":"patrick.oberherr@gmail.com"},{"name":"roboben","email":"ben@contentful.com"},{"name":"rodrigodalcindev","email":"rodrigodalcin.dev@gmail.com"},{"name":"ronaldronson","email":"ronald.ronson@outlook.com"},{"name":"sbezludny","email":"serg.bezludny@gmail.com"},{"name":"sey1000","email":"sey.cheon@contentful.com"},{"name":"silhoue","email":"joanna@contentful.com"},{"name":"stefanjudis","email":"stefanjudis@gmail.com"},{"name":"stupchiy","email":"sergiy@contentful.com"},{"name":"suevalov","email":"suevalov.work@gmail.com"},{"name":"thebesson","email":"tankidet@gmail.com"},{"name":"timbeyer","email":"tim.beyer@gmail.com"},{"name":"tolgaakyuz","email":"me@tolgaakyuz.org"},{"name":"yann-cf","email":"yann.hamon@contentful.com"},{"name":"zcei","email":"stephanschndr@gmail.com"},{"name":"zeusdeux","email":"zeusdeux@gmail.com"}],"homepage":"https://github.com/contentful/rich-text-renderers#readme","bugs":{"url":"https://github.com/contentful/rich-text-renderers/issues"},"dist":{"shasum":"06a9944f38701b9b9aaffa8fb27a4a0e7e8fd67e","tarball":"https://registry.npmjs.org/@contentful/rich-text-html-renderer--demo/-/rich-text-html-renderer--demo-5.0.0.tgz","fileCount":49,"integrity":"sha512-gRYlmT6lGZmtcfSytkw4YFcx1TunSG3pchBjXJMfRa1NcuXYSyoZBA+tkWB0kkkolSaOxU5gBovV79dBvl43qw==","signatures":[{"sig":"MEYCIQCrxusZXnqaY3ZKuHt2YKONNlTmd24Fu21J2Sn7qhmhJgIhAK9w2hR8gWFaLMszl8YziWRrDPwnyrq3d3712cRow26j","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68629,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0dimCRA9TVsSAnZWagAA0LcP/1A0HwzkmXReZT/YypbG\nUpzQ89JbcA4Yw6k9gB98JMg9j4H2h2E5UGfWMj6sAuPUIumzHg3WjwAvDanM\nH44Od4MEprk9JSpexzf7L9seVsmmsrq0oXHwci/Qij8K4LqCGeg7D6p/G0X5\nzcFz+8nkbBiPEj6MSUO1ft/szPsoYg/7xnpq+2cewnYImwUo2MZ0SHCrHy+7\nAsLM8eI+IrCwkLJ0cpNEpzBQK5pN4zwX/2CQ+cUXxVO3ZlOO8PRTI0k9t3ZI\n6tKnUuvTEosBwAK/hBGxK9EwXBkSp0WVNH5b6B6FvC7AMwUu+iztEoCSh0IH\nbgd0EyiFzZ8fxbqk+E0kO9wH77DiOT44am9m6CnjE9MOzRccIdx6rK9ECKYp\nxXckPGVpfS8LUmb+boSOSs3HXxvLF9VMib6YMa3ijmNekDWa0dBXkOiqy/PM\nZ7XZPupg/E3pySYY2pwptbvenRC64CV8lIcqA6zQDzGyKesvVpFs/babSAbJ\nbMxxJNkVcfv4fQzBwrDcR90p18mCMOAc7wlN4xAM0tGcz200rfymcIEs21gh\nuqxC81ldXnOhdD8n7JiG67GjRCNCz6MePF7BepZ5+FWsdm8mnv8ZAuf9D7MX\nSw13wpSXiTq9+t2toZg693bMtvbW39pZV7nM359Tb6DBeDPvXSJ5CWTFF/N4\nrune\r\n=YL3J\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/rich-text-html-renderer--demo.es5.js","engines":{"node":">=6.0.0"},"scripts":{"build":"tsc --module commonjs && rollup -c rollup.config.js","start":"tsc && rollup -c rollup.config.js -w","prebuild":"rimraf dist","report-coverage":"cat ./coverage/lcov.info | coveralls"},"typings":"dist/types/rich-text-html-renderer--demo.d.ts","_npmUser":{"name":"cribbles","email":"csloop@wesleyan.edu"},"repository":{"url":"git+https://github.com/contentful/rich-text-renderers.git","type":"git"},"_npmVersion":"6.4.1","description":"HTML renderer for the Rich Text document.","directories":{},"_nodeVersion":"8.11.1","dependencies":{"@contentful/rich-text-types--demo":"^0.0.0-determined-by-semantic-release"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","faker":"^4.1.0","husky":"^1.1.2","colors":"^1.1.2","git-cz":"^1.7.1","prompt":"^1.0.0","rimraf":"^2.6.2","rollup":"^0.66.6","tslint":"^5.11.0","ts-jest":"^23.10.4","ts-node":"^7.0.1","prettier":"^1.14.3","coveralls":"^3.0.2","cross-env":"^5.2.0","commitizen":"^3.0.4","typescript":"^2.6.2","@types/jest":"^22.0.0","@types/node":"^10.0.3","lint-staged":"^7.3.0","@types/faker":"^4.1.2","replace-in-file":"^3.4.2","lodash.camelcase":"^4.3.0","semantic-release":"^15.10.5","@types/lodash.omit":"^4.5.3","rollup-plugin-json":"^3.1.0","travis-deploy-once":"^5.0.9","validate-commit-msg":"^2.14.0","@types/lodash.flatmap":"^4.5.3","rollup-plugin-commonjs":"^9.2.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.1","rollup-plugin-sourcemaps":"^0.4.2","cz-conventional-changelog":"^2.1.0","rollup-plugin-typescript2":"^0.17.2","rollup-plugin-node-resolve":"^3.4.0","@contentful/rich-text-types--demo":"^0.0.0-determined-by-semantic-release"},"_npmOperationalInternal":{"tmp":"tmp/rich-text-html-renderer--demo_5.0.0_1540479141508_0.848185262917531","host":"s3://npm-registry-packages"}},"6.0.0":{"name":"@contentful/rich-text-html-renderer--demo","version":"6.0.0","license":"MIT","_id":"@contentful/rich-text-html-renderer--demo@6.0.0","maintainers":[{"name":"axe312","email":"roetsch.beni@googlemail.com"},{"name":"cribbles","email":"csloop@wesleyan.edu"},{"name":"danwe","email":"daniel.a.r.werner@gmail.com"},{"name":"dominik.markusic","email":"dominik.markusic@contentful.com"},{"name":"eamodeorubio","email":"eamodeorubio@gmail.com"},{"name":"elblivion","email":"anthony+nonpmspam@contentful.com"},{"name":"ewakurekmqa","email":"ewa@contentful.com"},{"name":"farruco.sanjurjo","email":"farruco.sanjurjo@gmail.com"},{"name":"felipecoe","email":"felipe@contentful.com"},{"name":"guilebarbosa","email":"guipvb@gmail.com"},{"name":"hollensteiner","email":"claushollensteiner@gmail.com"},{"name":"it-internal","email":"it-internal@contentful.com"},{"name":"jakub-contentful","email":"jakub@contentful.com"},{"name":"johannes_bugiel","email":"johannes.bugiel@contentful.com"},{"name":"johanneswuerbach","email":"johannes.wuerbach@googlemail.com"},{"name":"joshuasmock","email":"f1144756@mvrht.com"},{"name":"jpawlyn","email":"jpawlyn@gmail.com"},{"name":"kgarbaya","email":"kgarbaya@gmail.com"},{"name":"lneves75","email":"luis.neves75@gmail.com"},{"name":"m10l","email":"mike.mitchell@contentful.com"},{"name":"marina-cf","email":"marina.guseva@contentful.com"},{"name":"markuslaut","email":"markus.lautenbach@contentful.com"},{"name":"martzoukos","email":"spiros@contentful.com"},{"name":"medturki","email":"mohamed@contentful.com"},{"name":"ohookins-ctf","email":"oliver@contentful.com"},{"name":"phbschmidt","email":"phoebe.schmidt@contentful.com"},{"name":"poberherr","email":"patrick.oberherr@gmail.com"},{"name":"roboben","email":"ben@contentful.com"},{"name":"ronaldronson","email":"ronald.ronson@outlook.com"},{"name":"sbezludny","email":"serg.bezludny@gmail.com"},{"name":"sey1000","email":"sey.cheon@contentful.com"},{"name":"silhoue","email":"joanna@contentful.com"},{"name":"stefanjudis","email":"stefanjudis@gmail.com"},{"name":"stupchiy","email":"sergiy@contentful.com"},{"name":"suevalov","email":"suevalov.work@gmail.com"},{"name":"thebesson","email":"tankidet@gmail.com"},{"name":"timbeyer","email":"tim.beyer@gmail.com"},{"name":"zcei","email":"stephanschndr@gmail.com"},{"name":"zeusdeux","email":"zeusdeux@gmail.com"}],"homepage":"https://github.com/contentful/rich-text-renderers#readme","bugs":{"url":"https://github.com/contentful/rich-text-renderers/issues"},"dist":{"shasum":"7d06a6ec6b6c142efcb9ec5104a6fc3d39219822","tarball":"https://registry.npmjs.org/@contentful/rich-text-html-renderer--demo/-/rich-text-html-renderer--demo-6.0.0.tgz","fileCount":49,"integrity":"sha512-S8b7SGOTU/y/3NE3XkzyHDxI2fpTUjwSbpjCPm7OsUH6Nq3+Y/l2Z2qmsY2YdkC7PvfM31ct1/oKuR0oNHgL8w==","signatures":[{"sig":"MEQCIH4PiE+IQj1QyaBG99YOV58lbLVhp05acmlzOUy0MrddAiAXb14jilmgWG/QE1WIKjBsDqEot/5gGu0iglhMPKKGOA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68515,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0ehQCRA9TVsSAnZWagAAi9MP/1RldgJM+kVsBl3jNewx\nkcYEpPP9zsX3zYqklAfKAx0KdzQrsQrMMaluQxkOgRmnaZ5PKlzNwmfDCqVC\nhiQM+aUbQZQJWuJ0gxUM2mYumpNVHzJbTICKiREKuPEfzMiFrSDc/o2ewMYP\np7kQZ69xzATWNlF0yVMeU8SxT/kxc6QYuRtCkf1/0MkASDQ/e50S2u5K8qYb\nIKIb46NAJ33BqVETwVUQUYIuUPXLnvJz1SpaJp2loF8gwWu/7e5jdrgDi/Cl\nM0aPul71gwbpTKA7NFUib4Jj7RbcCbxrMoxH1fc3pabHic7n/+tb/UcuNQ4D\nx2UkxNshov7w1ytk8T5FG2Y9mVHRu9adUWUYX2KfHGs6HLOQhz+a59r7rFax\n3s8j70TQKCKrEW0Ag580kHPH6/kP1hUfawgi18ZauMtiL05vimELXfMWDNol\naIGfpW4plI3Hg5RNDM2fh50UL+P2Hpg49UP7dpxJ2IlH/znAl/WkF4SgTC6Z\nPWuKx8F0D8yr2BH4TAVka0/VQ8MpHWR+yR51gOo89x71tGAhY0QoPUpMjcmT\nD00pnSxguZeYT9ARzbbIzbDck5IiKz/Co+I8hbSJkW24cFG8HdRYOG4iTWQz\n1apsB1pJBjgsIDP76kf9noqclj0Ey1Kb5U3ECWIfMqcDXWvTEbIR+hXWPKxr\nJRTb\r\n=Rdbb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/rich-text-html-renderer--demo.es5.js","engines":{"node":">=6.0.0"},"scripts":{"build":"tsc --module commonjs && rollup -c rollup.config.js","start":"tsc && rollup -c rollup.config.js -w","prebuild":"rimraf dist","report-coverage":"cat ./coverage/lcov.info | coveralls"},"typings":"dist/types/rich-text-html-renderer--demo.d.ts","_npmUser":{"name":"cribbles","email":"csloop@wesleyan.edu"},"repository":{"url":"git+https://github.com/contentful/rich-text-renderers.git","type":"git"},"_npmVersion":"6.4.1","description":"HTML renderer for the Rich Text document.","directories":{},"_nodeVersion":"8.11.1","dependencies":{"@contentful/rich-text-types--demo":"6.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","faker":"^4.1.0","husky":"^1.1.2","colors":"^1.1.2","git-cz":"^1.7.1","prompt":"^1.0.0","rimraf":"^2.6.2","rollup":"^0.66.6","tslint":"^5.11.0","ts-jest":"^23.10.4","ts-node":"^7.0.1","prettier":"^1.14.3","coveralls":"^3.0.2","cross-env":"^5.2.0","commitizen":"^3.0.4","typescript":"^2.6.2","@types/jest":"^22.0.0","@types/node":"^10.0.3","lint-staged":"^7.3.0","@types/faker":"^4.1.2","replace-in-file":"^3.4.2","lodash.camelcase":"^4.3.0","semantic-release":"^15.10.5","@types/lodash.omit":"^4.5.3","rollup-plugin-json":"^3.1.0","travis-deploy-once":"^5.0.9","validate-commit-msg":"^2.14.0","@types/lodash.flatmap":"^4.5.3","rollup-plugin-commonjs":"^9.2.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.1","rollup-plugin-sourcemaps":"^0.4.2","cz-conventional-changelog":"^2.1.0","rollup-plugin-typescript2":"^0.17.2","rollup-plugin-node-resolve":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/rich-text-html-renderer--demo_6.0.0_1540483151519_0.27206141372407666","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-10-25T14:52:21.348Z","modified":"2026-05-28T10:29:18.074Z","5.0.0":"2018-10-25T14:52:21.647Z","6.0.0":"2018-10-25T15:59:11.675Z"},"bugs":{"url":"https://github.com/contentful/rich-text-renderers/issues"},"license":"MIT","homepage":"https://github.com/contentful/rich-text-renderers#readme","repository":{"url":"git+https://github.com/contentful/rich-text-renderers.git","type":"git"},"description":"HTML renderer for the Rich Text document.","maintainers":[{"email":"it-internal@contentful.com","name":"it-internal"},{"email":"npm@contentful.com","name":"whydah-gally"},{"email":"team-mechagodzilla@contentful.com","name":"contentful-ecosystem"},{"email":"michael.pearce@contentful.com","name":"michaelpearce"}],"readme":"# rich-text-html-renderer--demo\nHTML renderer for the Rich Text document.\n\n## Installation\nUsing [npm](http://npmjs.org/):\n\n```javascript\nnpm install @contentful/rich-text-html-renderer--demo\n```\n\nUsing [yarn](https://yarnpkg.com/):\n```javascript\nyarn add @contentful/rich-text-html-renderer--demo\n```\n\n## Usage\n\n```javascript\nimport { documentToHtmlString } from '@contentful/rich-text-html-renderer--demo';\n\nconst document = {\n  nodeType: 'document',\n  nodeClass: 'document',\n  content: [\n    {\n      nodeClass: 'block',\n      nodeType: 'paragraph',\n      content: [\n        {\n          nodeClass: 'text',\n          nodeType: 'text',\n          value: 'Hello world!',\n          marks: [],\n        },\n      ],\n    },\n  ]\n};\n\ndocumentToHtmlString(document); // -> <p>Hello world!</p>\n```\n\n```javascript\nimport { documentToHtmlString } from '@contentful/rich-text-html-renderer--demo';\n\nconst document = {\n  nodeType: 'document',\n  nodeClass: 'document',\n  content: [\n    {\n      nodeClass: 'block',\n      nodeType: 'paragraph',\n      content: [\n        {\n          nodeClass: 'text',\n          nodeType: 'text',\n          value: 'Hello',\n          marks: [{ nodeType: 'bold' }]\n        },\n        {\n          nodeClass: 'text',\n          nodeType: 'text',\n          value: ' world!',\n          marks: [{ nodeType: 'italic' }]\n        },\n      ],\n    },\n  ]\n};\n\ndocumentToHtmlString(document); // -> <p><b>Hello</b><u> world!</u></p>\n```\n\nYou can also pass custom renderers for both marks and nodes as an optional parameter like so:\n\n```javascript\nimport { BLOCKS.PARAGRAPH, MARKS.BOLD } from '@contentful/rich-text-types--demo';\nimport { documentToHtmlString } from '@contentful/rich-text-html-renderer--demo';\n\nconst document = {\n  nodeType: 'document',\n  nodeClass: 'document',\n  content: [\n    {\n      nodeClass: 'block',\n      nodeType: 'paragraph',\n      content: [\n        {\n          nodeClass: 'text',\n          nodeType: 'text',\n          value: 'Hello',\n          marks: [{ nodeType: 'bold' }]\n        },\n        {\n          nodeClass: 'text',\n          nodeType: 'text',\n          value: ' world!',\n          marks: [{ nodeType: 'italic' }]\n        },\n      ],\n    },\n  ]\n};\n\nconst options = {\n  renderMark: {\n    [MARKS.BOLD]: text => `<custom-bold>${text}<custom-bold>`\n  },\n  renderNode: {\n    [BLOCKS.PARAGRAPH]: (node, next) => `<custom-paragraph>${next(node.content)}</custom-paragraph>`\n  }\n}\n\ndocumentToHtmlString(document, options);\n// -> <custom-paragraph><custom-bold>Hello</custom-bold><u> world!</u></custom-paragraph>\n```\n\nLast, but not least, you can pass a custom rendering component for an embedded entry:\n\n```javascript\nimport { BLOCKS.EMBEDDED_ENTRY } from '@contentful/rich-text-types--demo';\nimport { documentToHtmlString } from '@contentful/rich-text-html-renderer--demo';\n\nconst document = {\n  nodeType: 'document',\n  nodeClass: 'document',\n  content: [\n    {\n      nodeClass: 'block',\n      nodeType: 'embedded-entry-block',\n      data: {\n        target: (...)Link<'Entry'>(...);\n      },\n    },\n  ]\n};\n\nconst options = {\n  renderNode: {\n    [BLOCKS.EMBEDDED_ENTRY]: (node) => `<custom-component>${customComponentRenderer(node)}</custom-component>`\n  }\n}\n\ndocumentToHtmlString(document, options);\n// -> <custom-component>(...)Link<'Entry'>(...)</custom-component>\n```\n\nThe `renderNode` keys should be one of the following `BLOCKS` and `INLINES` properties as defined in [`@contentful/rich-text-types--demo`](https://www.npmjs.com/package/@contentful/rich-text-types--demo):\n* `BLOCKS`\n  * `DOCUMENT`\n  * `PARAGRAPH`\n  * `HEADING_1`\n  * `HEADING_2`\n  * `HEADING_3`\n  * `HEADING_4`\n  * `HEADING_5`\n  * `HEADING_6`\n  * `UL_LIST`\n  * `OL_LIST`\n  * `LIST_ITEM`\n  * `QUOTE`\n  * `HR`\n  * `EMBDEDDED_ENTRY`\n* `INLINES`\n  * `EMBEDDED_ENTRY` (this is different from the `BLOCKS.EMBEDDED_ENTRY`)\n  * `HYPERLINK`\n  * `ENTRY_HYPERLINK`\n  * `ASSET_HYPERLINK`\n\nThe `renderMark` keys should be one of the following `MARKS` properties as defined in [`@contentful/rich-text-types--demo`](https://www.npmjs.com/package/@contentful/rich-text-types--demo):\n\n  * `BOLD`\n  * `ITALIC`\n  * `UNDERLINE`\n  * `CODE`\n","readmeFilename":"README.md"}