@turbodocx/html-to-docx 1.13.5 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,32 @@
1
1
  [![TurboDocx](./banner.png)](https://www.turbodocx.com)
2
2
 
3
- html-to-docx
4
- ============
3
+ @turbodocx/html-to-docx
4
+ ====================
5
5
  [![NPM Version][npm-image]][npm-url]
6
+ [![GitHub Stars](https://img.shields.io/github/stars/turbodocx/html-to-docx?style=social)](https://github.com/turbodocx/html-to-docx)
6
7
  [![Type Script](https://shields.io/badge/TypeScript-3178C6?logo=TypeScript&logoColor=FFF&style=flat-square)](https://typescript.org)
7
8
  [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord)](https://discord.gg/NYKwz4BcpX)
8
- [![npm](https://img.shields.io/npm/dw/@turbodocx/html-to-docx)](https://www.npmjs.com/package/@turbodocx/html-to-docx)
9
+ [![npm](https://img.shields.io/npm/dm/@turbodocx/html-to-docx)](https://www.npmjs.com/package/@turbodocx/html-to-docx)
9
10
  [![X](https://img.shields.io/badge/X-@TurboDocx-1DA1F2?logo=x&logoColor=white)](https://twitter.com/TurboDocx)
10
11
  [![Embed TurboDocx in Your App in Minutes](https://img.shields.io/badge/Embed%20TurboDocx%20in%20Your%20App%20in%20Minutes-8A2BE2)](https://www.turbodocx.com/use-cases/embedded-api?utm_source=github&utm_medium=repo&utm_campaign=open_source)
11
12
 
12
- `@turbodocx/html-to-docx` is a powerful JavaScript library designed to convert HTML documents to DOCX format, compatible with Microsoft Word 2007+, LibreOffice Writer, Google Docs, WPS Writer, and other word processors. Inspired by [@PrivateOmega]("https://github.com/privateOmega/"), this is supported by TurboDocx to ensure ongoing development and improvements.
13
+ Convert HTML to Word, Google Docs, and DOCX files with the fastest, most reliable JavaScript library available. Built for modern applications that demand speed and precision—from AI-powered document generation to enterprise reporting systems.
13
14
 
14
- ### Disclaimer
15
+ Based on the original work and assisted by the original contributors of [privateOmega/html-to-docx](https://github.com/privateOmega/html-to-docx), this library is now actively maintained and enhanced by TurboDocx, ensuring continuous improvements and long-term support for production environments.
15
16
 
16
- While `@turbodocx/html-to-docx` is robust and used in production environments, it is continually evolving. Please ensure it meets your specific needs through thorough testing. Note that it currently does not work directly in the browser.
17
+ ## Why @turbodocx/html-to-docx?
18
+
19
+ 🚀 **Lightning Fast Performance** - Pure JavaScript implementation with no dependencies on headless browsers or external binaries. Perfect for AI applications that need rapid document generation.
20
+
21
+ 🔄 **Active Maintenance & Support** - Backed by TurboDocx with regular updates, bug fixes, and feature enhancements. Not another abandoned open-source project.
22
+
23
+ 🤖 **AI-Ready Architecture** - Designed for modern AI workflows where speed matters. Generate thousands of documents without the overhead of browser automation.
24
+
25
+ ⚡ **Zero External Dependencies** - No need for Puppeteer, Chrome, or LibreOffice. Pure Node.js implementation that works in any environment.
26
+
27
+ 🎯 **Production Battle-Tested** - Used in production environments processing thousands of documents. Reliable, stable, and performant at scale.
28
+
29
+ 🛠️ **Developer Experience** - Full TypeScript support, comprehensive documentation, and extensive examples to get you up and running in minutes.
17
30
 
18
31
  ## Installation
19
32
 
@@ -192,6 +205,7 @@ full fledged examples can be found under `example/`
192
205
  - `defaultOrderedListStyleType` <?[String]> default ordered list style type. Defaults to `decimal`.
193
206
  - `decodeUnicode` <?[Boolean]> flag to enable unicode decoding of header, body and footer. Defaults to `false`.
194
207
  - `lang` <?[String]> language localization code for spell checker to work properly. Defaults to `en-US`.
208
+ - `direction` <?[String]> text direction for RTL (right-to-left) languages. Set to `'rtl'` for Arabic, Hebrew, etc. Defaults to `'ltr'`.
195
209
  - `preProcessing` <?[Object]>
196
210
  - `skipHTMLMinify` <?[Boolean]> flag to skip minification of HTML. Defaults to `false`.
197
211
  - `footerHTMLString` <[String]> clean html string equivalent of footer. Defaults to `<p></p>` if footer flag is `true`.
@@ -227,6 +241,27 @@ Also you could add attribute `data-start="n"` to start the numbering from the n-
227
241
  `<ol data-start="2">` will start the numbering from ( B. b. II. ii. 2. )
228
242
 
229
243
 
244
+ ## RTL (Right-to-Left) Language Support
245
+
246
+ The library also supports RTL languages like Arabic and Hebrew. Use the `direction` option to enable RTL text flow:
247
+
248
+ ```javascript
249
+ const htmlString = `
250
+ <h1>مرحبا بالعالم</h1>
251
+ <p>هذا نص تجريبي باللغة العربية ليظهر من اليمين إلى اليسار</p>
252
+ `;
253
+
254
+ const docx = await HTMLtoDOCX(htmlString, null, {
255
+ direction: 'rtl', // Enable RTL text direction
256
+ lang: 'ar-SA', // Arabic locale (or 'he-IL' for Hebrew)
257
+ font: 'Arial', // Use a font that supports RTL characters
258
+ });
259
+ ```
260
+
261
+ For more RTL examples, check `example/react-example/src/example-rtl.js`.
262
+
263
+ ## Font Compatibility
264
+
230
265
  Font family doesnt work consistently for all word processor softwares
231
266
 
232
267
  - Word Desktop work as intended
@@ -274,3 +309,7 @@ MIT
274
309
  </a>
275
310
 
276
311
  Made with [contrib.rocks](https://contrib.rocks).
312
+
313
+ ---
314
+
315
+ **Note:** Currently optimized for Node.js environments. Browser support is planned for future releases.