@turbodocx/html-to-docx 1.14.0 → 1.15.2
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/LICENSE +3 -1
- package/README.md +22 -0
- package/dist/html-to-docx.esm.js +1 -1
- package/dist/html-to-docx.umd.js +1 -1
- package/index.d.ts +1 -0
- package/package.json +24 -4
- package/scripts/messages.json +142 -0
- package/scripts/postinstall.js +57 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2020 privateOmega <privateOmega@protonmail.com>
|
|
4
|
+
Copyright (c) 2023 turbodocx
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
8
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
20
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
21
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
23
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -205,6 +205,7 @@ full fledged examples can be found under `example/`
|
|
|
205
205
|
- `defaultOrderedListStyleType` <?[String]> default ordered list style type. Defaults to `decimal`.
|
|
206
206
|
- `decodeUnicode` <?[Boolean]> flag to enable unicode decoding of header, body and footer. Defaults to `false`.
|
|
207
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'`.
|
|
208
209
|
- `preProcessing` <?[Object]>
|
|
209
210
|
- `skipHTMLMinify` <?[Boolean]> flag to skip minification of HTML. Defaults to `false`.
|
|
210
211
|
- `footerHTMLString` <[String]> clean html string equivalent of footer. Defaults to `<p></p>` if footer flag is `true`.
|
|
@@ -240,6 +241,27 @@ Also you could add attribute `data-start="n"` to start the numbering from the n-
|
|
|
240
241
|
`<ol data-start="2">` will start the numbering from ( B. b. II. ii. 2. )
|
|
241
242
|
|
|
242
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
|
+
|
|
243
265
|
Font family doesnt work consistently for all word processor softwares
|
|
244
266
|
|
|
245
267
|
- Word Desktop work as intended
|