{"_id":"@dezi/html-to-docx","_rev":"5-d12cc7b5e8131b1723cba94554265d54","time":{"created":"2024-02-21T08:27:02.680Z","1.8.0":"2024-02-21T07:51:03.854Z","modified":"2024-02-21T13:34:48.372Z","1.8.1":"2024-02-21T08:27:03.055Z","1.8.2":"2024-02-21T13:30:27.910Z","1.8.3":"2024-02-21T13:34:47.939Z"},"name":"@dezi/html-to-docx","dist-tags":{"latest":"1.8.3"},"versions":{"1.8.1":{"name":"@dezi/html-to-docx","version":"1.8.1","description":"HTML to DOCX converter","keywords":["html","docx","html-to-docx","html to docx","office","word"],"main":"dist/html-to-docx.umd.js","module":"dist/html-to-docx.mjs","scripts":{"test":"npm run build && node example/example-node.js","prerelease":"vite build","release":"standard-version","lint":"eslint --fix .","prettier:check":"prettier --check '**/*.{js}'","validate":"run-s lint prettier:check","build":"vite build","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/privateOmega/html-to-docx.git"},"author":{"name":"privateOmega","email":"privateOmega@protonmail.com"},"contributors":[{"name":"amrita-syn","email":"amrita.yadav@synapsica.com"},{"name":"charuthaB","email":"charutha.bhaskar@synapsica.com"},{"name":"hanagejet"},{"name":"kurukururuu","email":"apriansyah.fajar94@gmail.com"},{"name":"erenard"},{"name":"KeithGillette"},{"name":"juralio-james"},{"name":"nicolasiscoding","email":"nicolascoding@gmail.com"},{"name":"zedtux","email":"zedtux@zedroot.org"},{"name":"hlerebours"},{"name":"hakjeri"},{"name":"tasola"}],"license":"MIT","bugs":{"url":"https://github.com/privateOmega/html-to-docx/issues"},"homepage":"https://github.com/privateOmega/html-to-docx#readme","devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","eslint":"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.24.2","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.0","lint-staged":"^11.1.2","prettier":"^2.4.1","standard-version":"^9.3.1","vite":"^5.0.11","vite-plugin-node-polyfills":"^0.19.0"},"dependencies":{"@oozcitak/dom":"1.15.6","@oozcitak/util":"8.3.4","color-name":"^1.1.4","htmlparser2":"^9.0.0","image-size":"^1.1.1","jszip":"^3.10.1","mime-types":"^2.1.35","nanoid":"^3.1.25","style-to-js":"^1.1.10","xmlbuilder2":"2.1.2"},"lint-staged":{"src/**/*.js":["prettier --write","eslint --fix"]},"resolutions":{"@oozcitak/util":"8.3.4","@oozcitak/dom":"1.15.6"},"overrides":{"@oozcitak/util":"8.3.4","@oozcitak/dom":"1.15.6"},"_id":"@dezi/html-to-docx@1.8.1","gitHead":"7bea65fdd1996c0cdda1e6d6aa96fd512fbcd091","_nodeVersion":"20.10.0","_npmVersion":"10.2.5","dist":{"integrity":"sha512-fYw/eFsIbOLkf6nO9bLdSGoSMwkAmAoCDF3oLK2EQWG8OtRXOHB8OQyuMxi33EUHd21EfnsQfr1T23CXHjbfPA==","shasum":"25c7d71e17c5199d8a1cb792f61750138484ef12","tarball":"https://registry.npmjs.org/@dezi/html-to-docx/-/html-to-docx-1.8.1.tgz","fileCount":10,"unpackedSize":1606805,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDA/UJ4Sbb2L4Ws/DUfg7Dq3p6isTlHitJAhzrTQReqWAIhAJTNUrsEJ5W/8sjEJeW8Srttxg3TSrcVbXLap/NEaBM9"}]},"_npmUser":{"name":"dezirules","email":"dezinvoltu@gmail.com"},"directories":{},"maintainers":[{"name":"dezirules","email":"dezinvoltu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-docx_1.8.1_1708504022773_0.5280314154210508"},"_hasShrinkwrap":false},"1.8.2":{"name":"@dezi/html-to-docx","version":"1.8.2","description":"HTML to DOCX converter","keywords":["html","docx","html-to-docx","html to docx","office","word"],"main":"dist/html-to-docx.umd.js","module":"dist/html-to-docx.mjs","scripts":{"test":"npm run build && node example/example-node.js","prerelease":"vite build","release":"standard-version","lint":"eslint --fix .","prettier:check":"prettier --check '**/*.{js}'","validate":"run-s lint prettier:check","build":"vite build","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/privateOmega/html-to-docx.git"},"author":{"name":"privateOmega","email":"privateOmega@protonmail.com"},"contributors":[{"name":"amrita-syn","email":"amrita.yadav@synapsica.com"},{"name":"charuthaB","email":"charutha.bhaskar@synapsica.com"},{"name":"hanagejet"},{"name":"kurukururuu","email":"apriansyah.fajar94@gmail.com"},{"name":"erenard"},{"name":"KeithGillette"},{"name":"juralio-james"},{"name":"nicolasiscoding","email":"nicolascoding@gmail.com"},{"name":"zedtux","email":"zedtux@zedroot.org"},{"name":"hlerebours"},{"name":"hakjeri"},{"name":"tasola"}],"license":"MIT","bugs":{"url":"https://github.com/privateOmega/html-to-docx/issues"},"homepage":"https://github.com/privateOmega/html-to-docx#readme","devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","eslint":"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.24.2","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.0","lint-staged":"^11.1.2","prettier":"^2.4.1","standard-version":"^9.3.1","vite":"^5.0.11","vite-plugin-node-polyfills":"^0.19.0"},"dependencies":{"@oozcitak/dom":"1.15.6","@oozcitak/util":"8.3.4","color-name":"^1.1.4","htmlparser2":"^9.0.0","image-size":"^1.1.1","jszip":"^3.10.1","mime-types":"^2.1.35","nanoid":"^3.1.25","style-to-js":"^1.1.10","xmlbuilder2":"2.1.2"},"lint-staged":{"src/**/*.js":["prettier --write","eslint --fix"]},"_id":"@dezi/html-to-docx@1.8.2","gitHead":"307a1f44c15cb8f6d26ea2db602f36c941769a0a","_nodeVersion":"20.10.0","_npmVersion":"10.2.5","dist":{"integrity":"sha512-enlIakISaIwvdap/XyHR323I/ZXdzpz3XgIwL1S+TEoagOypEKJLaDvPEaVX7MKZi+JkMn7sZ9fkUWIP49C9Wg==","shasum":"ea218f5a7ae233a79b21f02ba2596e511f581a03","tarball":"https://registry.npmjs.org/@dezi/html-to-docx/-/html-to-docx-1.8.2.tgz","fileCount":10,"unpackedSize":1606629,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHAgxCOw2KpWVPrXCvwgh7SwdLuZ2gmpDtsb+PQW3VsnAiEAxYcXG0ZvSrCTPDP6xnsIp2L2+KJWgp8GhObmTMSS5pY="}]},"_npmUser":{"name":"dezirules","email":"dezinvoltu@gmail.com"},"directories":{},"maintainers":[{"name":"dezirules","email":"dezinvoltu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-docx_1.8.2_1708522227734_0.09174991787135389"},"_hasShrinkwrap":false},"1.8.3":{"name":"@dezi/html-to-docx","version":"1.8.3","description":"HTML to DOCX converter","keywords":["html","docx","html-to-docx","html to docx","office","word"],"main":"dist/html-to-docx.umd.js","module":"dist/html-to-docx.mjs","scripts":{"test":"npm run build && node example/example-node.js","prerelease":"vite build","release":"standard-version","lint":"eslint --fix .","prettier:check":"prettier --check '**/*.{js}'","validate":"run-s lint prettier:check","build":"vite build","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/privateOmega/html-to-docx.git"},"author":{"name":"privateOmega","email":"privateOmega@protonmail.com"},"contributors":[{"name":"amrita-syn","email":"amrita.yadav@synapsica.com"},{"name":"charuthaB","email":"charutha.bhaskar@synapsica.com"},{"name":"hanagejet"},{"name":"kurukururuu","email":"apriansyah.fajar94@gmail.com"},{"name":"erenard"},{"name":"KeithGillette"},{"name":"juralio-james"},{"name":"nicolasiscoding","email":"nicolascoding@gmail.com"},{"name":"zedtux","email":"zedtux@zedroot.org"},{"name":"hlerebours"},{"name":"hakjeri"},{"name":"tasola"}],"license":"MIT","bugs":{"url":"https://github.com/privateOmega/html-to-docx/issues"},"homepage":"https://github.com/privateOmega/html-to-docx#readme","devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","eslint":"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.24.2","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.0","lint-staged":"^11.1.2","prettier":"^2.4.1","standard-version":"^9.3.1","vite":"^5.0.11","vite-plugin-node-polyfills":"^0.19.0"},"dependencies":{"@oozcitak/dom":"1.15.6","@oozcitak/util":"8.3.4","color-name":"^1.1.4","htmlparser2":"^9.0.0","image-size":"^1.1.1","jszip":"^3.10.1","mime-types":"^2.1.35","nanoid":"^3.1.25","style-to-js":"^1.1.10","xmlbuilder2":"2.1.2"},"lint-staged":{"src/**/*.js":["prettier --write","eslint --fix"]},"resolutions":{"@oozcitak/util":"8.3.4","@oozcitak/dom":"1.15.6"},"overrides":{"@oozcitak/util":"8.3.4","@oozcitak/dom":"1.15.6"},"_id":"@dezi/html-to-docx@1.8.3","gitHead":"52f15c344826292d8e11bd15f5cf43b9a901c14d","_nodeVersion":"20.10.0","_npmVersion":"10.2.5","dist":{"integrity":"sha512-b7AXLmmKn0N/hUtAzcwsyI4i8emTPH1OyixdNVfjJmzSc2sbju5A4sQSzgwrejEo95dS6DeNvtPpLRtT0AfNTQ==","shasum":"ce5a9d2f3a97ac16da2f88a3cb93520b7dcfdafe","tarball":"https://registry.npmjs.org/@dezi/html-to-docx/-/html-to-docx-1.8.3.tgz","fileCount":10,"unpackedSize":1606805,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCp8RRxg+UdAWfLY7nNwRqPNIT+G57LIFjgz4v4ut3aVAIhAL4+xo72RfLtFJ2AZ0MgJVnYIgHaXr4vO+9oIGm85Iea"}]},"_npmUser":{"name":"dezirules","email":"dezinvoltu@gmail.com"},"directories":{},"maintainers":[{"name":"dezirules","email":"dezinvoltu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-docx_1.8.3_1708522487742_0.05286976210230043"},"_hasShrinkwrap":false}},"maintainers":[{"name":"dezirules","email":"dezinvoltu@gmail.com"}],"description":"HTML to DOCX converter","homepage":"https://github.com/privateOmega/html-to-docx#readme","keywords":["html","docx","html-to-docx","html to docx","office","word"],"repository":{"type":"git","url":"git+https://github.com/privateOmega/html-to-docx.git"},"contributors":[{"name":"amrita-syn","email":"amrita.yadav@synapsica.com"},{"name":"charuthaB","email":"charutha.bhaskar@synapsica.com"},{"name":"hanagejet"},{"name":"kurukururuu","email":"apriansyah.fajar94@gmail.com"},{"name":"erenard"},{"name":"KeithGillette"},{"name":"juralio-james"},{"name":"nicolasiscoding","email":"nicolascoding@gmail.com"},{"name":"zedtux","email":"zedtux@zedroot.org"},{"name":"hlerebours"},{"name":"hakjeri"},{"name":"tasola"}],"author":{"name":"privateOmega","email":"privateOmega@protonmail.com"},"bugs":{"url":"https://github.com/privateOmega/html-to-docx/issues"},"license":"MIT","readme":"html-to-docx\r\n============\r\n\r\n[![NPM Version][npm-image]][npm-url]\r\n\r\nhtml-to-docx is a js library for converting HTML documents to DOCX format supported by Microsoft Word 2007+, LibreOffice Writer, Google Docs, WPS Writer etc.\r\n\r\nIt was inspired by [html-docx-js] project but mitigates the problem of documents generated being non-compatiable with word processors like Google Docs and libreOffice Writer that doesn't support [altchunks] feature.\r\n\r\nhtml-to-docx earlier used to use [libtidy] to clean up the html before parsing, but had to remove it since it was causing so many dependency issues due to node-gyp.\r\n\r\n### Disclaimer\r\n\r\nEven though there is an instance of html-to-docx running in production, please ensure that it covers all the cases that you might be encountering usually, since this is not a complete solution.\r\n\r\nCurrently it doesn't work with browser directly, but it was tested against React.\r\n\r\n## Installation\r\n\r\nUse the npm to install foobar.\r\n\r\n```bash\r\nnpm install html-to-docx\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\nawait HTMLtoDOCX(htmlString, headerHTMLString, documentOptions, footerHTMLString)\r\n```\r\n\r\nfull fledged examples can be found under `example/`\r\n\r\n### Parameters\r\n\r\n- `htmlString` <[String]> clean html string equivalent of document content.\r\n- `headerHTMLString` <[String]> clean html string equivalent of header. Defaults to `<p></p>` if header flag is `true`.\r\n- `documentOptions` <?[Object]>\r\n  - `orientation` <\"portrait\"|\"landscape\"> defines the general orientation of the document. Defaults to portrait.\r\n  - `pageSize` <?[Object]> Defaults to U.S. letter portrait orientation.\r\n    - `width` <[Number]> width of the page for all pages in this section in [TWIP]. Defaults to 12240. Maximum 31680. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `height` <[Number]> height of the page for all pages in this section in [TWIP]. Defaults to 15840. Maximum 31680. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n  - `margins` <?[Object]>\r\n    - `top` <[Number]> distance between the top of the text margins for the main document and the top of the page for all pages in this section in [TWIP]. Defaults to 1440. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `right` <[Number]> distance between the right edge of the page and the right edge of the text extents for this document in [TWIP]. Defaults to 1800. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `bottom` <[Number]> distance between the bottom of text margins for the document and the bottom of the page in [TWIP]. Defaults to 1440. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `left` <[Number]> distance between the left edge of the page and the left edge of the text extents for this document in [TWIP]. Defaults to 1800. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `header` <[Number]> distance from the top edge of the page to the top edge of the header in [TWIP]. Defaults to 720. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `footer` <[Number]> distance from the bottom edge of the page to the bottom edge of the footer in [TWIP]. Defaults to 720. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n    - `gutter` <[Number]> amount of extra space added to the specified margin, above any existing margin values. This setting is typically used when a document is being created for binding in [TWIP]. Defaults to 0. Supports equivalent measurement in [pixel], [cm] or [inch].\r\n  - `title` <?[String]> title of the document.\r\n  - `subject` <?[String]> subject of the document.\r\n  - `creator` <?[String]> creator of the document. Defaults to `html-to-docx`\r\n  - `keywords` <?[Array]<[String]>> keywords associated with the document. Defaults to ['html-to-docx'].\r\n  - `description` <?[String]> description of the document.\r\n  - `lastModifiedBy` <?[String]> last modifier of the document. Defaults to `html-to-docx`.\r\n  - `revision` <?[Number]> revision of the document. Defaults to `1`.\r\n  - `createdAt` <?[Date]> time of creation of the document. Defaults to current time.\r\n  - `modifiedAt` <?[Date]> time of last modification of the document. Defaults to current time.\r\n  - `headerType` <\"default\"|\"first\"|\"even\"> type of header. Defaults to `default`.\r\n  - `header` <?[Boolean]> flag to enable header. Defaults to `false`.\r\n  - `footerType` <\"default\"|\"first\"|\"even\"> type of footer. Defaults to `default`.\r\n  - `footer` <?[Boolean]> flag to enable footer. Defaults to `false`.\r\n  - `font` <?[String]> font name to be used. Defaults to `Times New Roman`.\r\n  - `fontSize` <?[Number]> size of font in HIP(Half of point). Defaults to `22`. Supports equivalent measure in [pt].\r\n  - `complexScriptFontSize` <?[Number]> size of complex script font in HIP(Half of point). Defaults to `22`. Supports equivalent measure in [pt].\r\n  - `table` <?[Object]>\r\n    - `row` <?[Object]>\r\n      - `cantSplit` <?[Boolean]> flag to allow table row to split across pages. Defaults to `false`.\r\n  - `pageNumber` <?[Boolean]> flag to enable page number in footer. Defaults to `false`. Page number works only if footer flag is set as `true`.\r\n  - `skipFirstHeaderFooter` <?[Boolean]> flag to skip first page header and footer. Defaults to `false`.\r\n  - `lineNumber` <?[Boolean]> flag to enable line numbering. Defaults to `false`.\r\n  - `lineNumberOptions` <?[Object]>\r\n    - `start` <[Number]> start of the numbering - 1. Defaults to `0`.\r\n    - `countBy` <[Number]> skip numbering in how many lines in between + 1. Defaults to `1`.\r\n    - `restart` <\"continuous\"|\"newPage\"|\"newSection\"> numbering restart strategy. Defaults to `continuous`.\r\n  - `numbering` <?[Object]>\r\n    - `defaultOrderedListStyleType` <?[String]> default ordered list style type. Defaults to `decimal`.\r\n  - `decodeUnicode` <?[Boolean]> flag to enable unicode decoding of header, body and footer. Defaults to `false`.\r\n  - `lang` <?[String]> language localization code for spell checker to work properly. Defaults to `en-US`.\r\n- `footerHTMLString` <[String]> clean html string equivalent of footer. Defaults to `<p></p>` if footer flag is `true`.\r\n\r\n### Returns\r\n\r\n<[Promise]<[Buffer]|[Blob]>>\r\n\r\n## Notes\r\n\r\nCurrently page break can be implemented by having div with classname \"page-break\" or style \"page-break-after\" despite the values of the \"page-break-after\", and contents inside the div element will be ignored. `<div class=\"page-break\" style=\"page-break-after: always;\"></div>`\r\n\r\n\r\nCSS list-style-type for `<ol>` element are now supported. Just do something like this in the HTML:\r\n```\r\n  <ol style=\"list-style-type:lower-alpha;\">\r\n    <li>List item</li>\r\n    ...\r\n  </ol>\r\n```\r\nList of supported list-style-types:\r\n- upper-alpha, will result in `A. List item`\r\n- lower-alpha, will result in `a. List item`\r\n- upper-roman, will result in `I. List item`\r\n- lower-roman, will result in `i. List item`\r\n- lower-alpha-bracket-end, will result in `a) List item`\r\n- decimal-bracket-end, will result in `1) List item`\r\n- decimal-bracket, will result in `(1) List item`\r\n- decimal, **(the default)** will result in `1. List item`\r\n\r\nAlso you could add attribute `data-start=\"n\"` to start the numbering from the n-th.\r\n\r\n`<ol data-start=\"2\">` will start the numbering from ( B. b. II. ii. 2. )\r\n\r\n\r\nFont family doesnt work consistently for all word processor softwares\r\n\r\n- Word Desktop work as intended\r\n- LibreOffice ignores the fontTable.xml file, and finds a font by itself\r\n- Word Online ignores the fontTable.xml file, and finds closest font in their font library\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\r\n\r\nPlease make sure to branch new branches off of develop for contribution.\r\n\r\n## Support\r\n\r\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/privateOmega)\r\n\r\n## License\r\n\r\nMIT\r\n\r\n[npm-image]: https://img.shields.io/npm/v/html-to-docx.svg\r\n[npm-url]: https://npmjs.org/package/html-to-docx\r\n[html-docx-js]: https://github.com/evidenceprime/html-docx-js \"html-docx-js\"\r\n[altchunks]: https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.altchunk?view=openxml-2.8.1 \"altchunks\"\r\n[libtidy]: https://github.com/jure/node-libtidy \"libtidy\"\r\n[String]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\"\r\n[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\"\r\n[Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\"\r\n[TWIP]: https://en.wikipedia.org/wiki/Twip \"TWIP\"\r\n[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array \"Array\"\r\n[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date \"Date\"\r\n[Boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\"\r\n[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise \"Promise\"\r\n[Buffer]: https://nodejs.org/api/buffer.html#buffer_buffer \"Buffer\"\r\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob \"Blob\"\r\n[pixel]: https://en.wikipedia.org/wiki/Pixel#:~:text=Pixels%2C%20abbreviated%20as%20%22px%22,what%20screen%20resolution%20views%20it. \"pixel\"\r\n[cm]: https://en.wikipedia.org/wiki/Centimetre \"cm\"\r\n[inch]: https://en.wikipedia.org/wiki/Inch \"inch\"\r\n[pt]: https://en.wikipedia.org/wiki/Point_(typography) \"pt\"\r\n\r\n## Contributors\r\n\r\n<a href=\"https://github.com/privateomega/html-to-docx/graphs/contributors\">\r\n  <img src=\"https://contrib.rocks/image?repo=privateomega/html-to-docx\" />\r\n</a>\r\n\r\nMade with [contrib.rocks](https://contrib.rocks).","readmeFilename":"README.md"}