Skip to content

Commit db5fa73

Browse files
Fix: Console.Warning -> Warn and rebase main (#36)
* Create FUNDING.yml * Feature/contributors update (#26) * feat: add contributors * fix: cleanup readme * feat: add banner and updated package.json * chore: fixes and update .gitignore * chore: readme styling * chore: readme refactor styling * Create npm-publish.yml (#27) * feat: cicd test * chore: update package-lock.json * feat: add build command to CI * fix: bump version for NPM release * Margin: Check Zero or Truth Values for Margin (#29) * refactor: remove unused import Signed-off-by: K-Kumar-01 <[email protected]> * feat: add util to check zero or truthy value Signed-off-by: K-Kumar-01 <[email protected]> * fix: margin attributes building Signed-off-by: K-Kumar-01 <[email protected]> * docs: update example for lists Signed-off-by: K-Kumar-01 <[email protected]> --------- Signed-off-by: K-Kumar-01 <[email protected]> * chore: bump version with new fixes * fix: move from console.warning to console.warn --------- Signed-off-by: K-Kumar-01 <[email protected]> Co-authored-by: Kushal Kumar <[email protected]>
1 parent c2a37d3 commit db5fa73

File tree

9 files changed

+71
-32
lines changed

9 files changed

+71
-32
lines changed

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
# github: TurboDocx
4+
custom: ["https://www.TurboDocx.com"]

.github/workflows/npm-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: TurboDocx NPM Release - Node.js Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 18
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: 18
29+
registry-url: https://registry.npmjs.org/
30+
- run: npm ci
31+
- run: npm run build
32+
- run: npm publish --access public
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
### Node ###
2+
3+
# Output Example.docx
4+
*.docx
5+
26
# Logs
37
logs
48
*.log

README.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1+
[![TurboDocx](./banner.png)](https://www.turbodocx.com)
2+
13
html-to-docx
24
============
3-
45
[![NPM Version][npm-image]][npm-url]
56

6-
html-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.
7-
8-
It 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.
9-
10-
html-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.
7+
`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. Originally created by [@PrivateOmega]("https://github.com/privateOmega/"), this hard fork is now maintained and supported by TurboDocx to ensure ongoing development and improvements.
118

129
### Disclaimer
1310

14-
Even 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.
15-
16-
Currently it doesn't work with browser directly, but it was tested against React.
11+
While `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.
1712

1813
## Installation
1914

20-
Use the npm to install foobar.
15+
Use the npm to install the project.
2116

2217
```bash
23-
npm install html-to-docx
18+
npm install @turbodocx/html-to-docx
2419
```
2520

2621
## Usage
@@ -128,15 +123,15 @@ Pull requests are welcome. For major changes, please open an issue first to disc
128123
Please make sure to branch new branches off of develop for contribution.
129124

130125
## Support
131-
132-
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/privateOmega)
126+
**Proudly Sponsored by TurboDocx**
127+
[!["Proudly Sponsored by TurboDocx"](https://image.typedream.com/cdn-cgi/image/width=1920,format=auto,fit=scale-down,quality=100/https://api.typedream.com/v0/document/public/de39171b-a5c9-49c5-bd9c-c2dfd5d632a2/2PZxyx12UwC5HrIA3p6lo16fCms_Group_16_1_.png)](https://www.TurboDocx.com)
133128

134129
## License
135130

136131
MIT
137132

138-
[npm-image]: https://img.shields.io/npm/v/html-to-docx.svg
139-
[npm-url]: https://npmjs.org/package/html-to-docx
133+
[npm-image]: https://img.shields.io/npm/v/@turbodocx/html-to-docx.svg
134+
[npm-url]: https://npmjs.org/package/@turbodocx/html-to-docx
140135
[html-docx-js]: https://github.com/evidenceprime/html-docx-js "html-docx-js"
141136
[altchunks]: https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.altchunk?view=openxml-2.8.1 "altchunks"
142137
[libtidy]: https://github.com/jure/node-libtidy "libtidy"
@@ -157,8 +152,8 @@ MIT
157152

158153
## Contributors
159154

160-
<a href="https://github.com/privateomega/html-to-docx/graphs/contributors">
161-
<img src="https://contrib.rocks/image?repo=privateomega/html-to-docx" />
155+
<a href="https://github.com/TurboDocx/html-to-docx/graphs/contributors">
156+
<img src="https://contrib.rocks/image?repo=turbodocx/html-to-docx" />
162157
</a>
163158

164159
Made with [contrib.rocks](https://contrib.rocks).

banner.png

93.5 KB
Loading

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "html-to-docx",
3-
"version": "1.1.2",
2+
"name": "@turbodocx/html-to-docx",
3+
"version": "1.9.4",
44
"description": "HTML to DOCX converter",
55
"keywords": [
66
"html",
@@ -24,9 +24,9 @@
2424
},
2525
"repository": {
2626
"type": "git",
27-
"url": "git+https://github.com/privateOmega/html-to-docx.git"
27+
"url": "git+https://github.com/turbodocx/html-to-docx.git"
2828
},
29-
"author": "privateOmega <[email protected]>",
29+
"author": "TurboDocx, Inc.",
3030
"contributors": [
3131
"amrita-syn <[email protected]>",
3232
"charuthaB <[email protected]>",
@@ -35,17 +35,19 @@
3535
"erenard",
3636
"KeithGillette",
3737
"juralio-james",
38-
"nicolasiscoding <[email protected]>",
38+
"nicolasiscoding",
39+
"K-Kumar-01 ",
40+
"Swayamshu",
3941
"zedtux <[email protected]>",
4042
"hlerebours",
4143
"hakjeri",
4244
"tasola"
4345
],
4446
"license": "MIT",
4547
"bugs": {
46-
"url": "https://github.com/privateOmega/html-to-docx/issues"
48+
"url": "https://github.com/TurboDocx/html-to-docx/issues"
4749
},
48-
"homepage": "https://github.com/privateOmega/html-to-docx#readme",
50+
"homepage": "https://github.com/TurboDocx/html-to-docx#readme",
4951
"devDependencies": {
5052
"@commitlint/cli": "^13.1.0",
5153
"@commitlint/config-conventional": "^13.1.0",

src/helpers/render-document-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const buildImage = async (docxDocumentInstance, vNode, maximumWidth = nul
3434
if (isValidUrl(imageSource)) {
3535
const base64String = await imageToBase64(imageSource).catch((error) => {
3636
// eslint-disable-next-line no-console
37-
console.warning(`skipping image download and conversion due to ${error}`);
37+
console.warn(`skipping image download and conversion due to ${error}`);
3838
});
3939

4040
if (base64String) {

src/helpers/xml-builder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ const buildRun = async (vNode, attributes, docxDocumentInstance) => {
961961
requiresConversion = true
962962
const base64String = await imageToBase64(imageSource).catch((error) => {
963963
// eslint-disable-next-line no-console
964-
console.warning(`skipping image download and conversion due to ${error}`);
964+
console.warn(`skipping image download and conversion due to ${error}`);
965965
});
966966
if (base64String) {
967967
isConverted = true;
@@ -1427,7 +1427,7 @@ const buildParagraph = async (vNode, attributes, docxDocumentInstance) => {
14271427
if (isValidUrl(imageSource)) {
14281428
base64String = await imageToBase64(imageSource).catch((error) => {
14291429
// eslint-disable-next-line no-console
1430-
console.warning(`skipping image download and conversion due to ${error}`);
1430+
console.warn(`skipping image download and conversion due to ${error}`);
14311431
});
14321432

14331433
if (base64String && getMimeType(imageSource, base64String)) {
@@ -1480,7 +1480,7 @@ const buildParagraph = async (vNode, attributes, docxDocumentInstance) => {
14801480
if (isValidUrl(imageSource)) {
14811481
base64String = await imageToBase64(imageSource).catch((error) => {
14821482
// eslint-disable-next-line no-console
1483-
console.warning(`skipping image download and conversion due to ${error}`);
1483+
console.warn(`skipping image download and conversion due to ${error}`);
14841484
});
14851485

14861486
if (base64String && getMimeType(imageSource, base64String)) {

0 commit comments

Comments
 (0)