Skip to content

Commit

Permalink
Fix: Console.Warning -> Warn and rebase main (#36)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
nicolasiscoding and K-Kumar-01 authored Jun 26, 2024
1 parent c2a37d3 commit db5fa73
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

# github: TurboDocx
custom: ["https://www.TurboDocx.com"]
34 changes: 34 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: TurboDocx NPM Release - Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
### Node ###

# Output Example.docx
*.docx

# Logs
logs
*.log
Expand Down
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
[![TurboDocx](./banner.png)](https://www.turbodocx.com)

html-to-docx
============

[![NPM Version][npm-image]][npm-url]

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.

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.

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.
`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.

### Disclaimer

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.

Currently it doesn't work with browser directly, but it was tested against React.
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.

## Installation

Use the npm to install foobar.
Use the npm to install the project.

```bash
npm install html-to-docx
npm install @turbodocx/html-to-docx
```

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

## Support

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/privateOmega)
**Proudly Sponsored by TurboDocx**
[!["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)

## License

MIT

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

## Contributors

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

Made with [contrib.rocks](https://contrib.rocks).
Binary file added banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-to-docx",
"version": "1.1.2",
"name": "@turbodocx/html-to-docx",
"version": "1.9.4",
"description": "HTML to DOCX converter",
"keywords": [
"html",
Expand All @@ -24,9 +24,9 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/privateOmega/html-to-docx.git"
"url": "git+https://github.com/turbodocx/html-to-docx.git"
},
"author": "privateOmega <[email protected]>",
"author": "TurboDocx, Inc.",
"contributors": [
"amrita-syn <[email protected]>",
"charuthaB <[email protected]>",
Expand All @@ -35,17 +35,19 @@
"erenard",
"KeithGillette",
"juralio-james",
"nicolasiscoding <[email protected]>",
"nicolasiscoding",
"K-Kumar-01 ",
"Swayamshu",
"zedtux <[email protected]>",
"hlerebours",
"hakjeri",
"tasola"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/privateOmega/html-to-docx/issues"
"url": "https://github.com/TurboDocx/html-to-docx/issues"
},
"homepage": "https://github.com/privateOmega/html-to-docx#readme",
"homepage": "https://github.com/TurboDocx/html-to-docx#readme",
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/render-document-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const buildImage = async (docxDocumentInstance, vNode, maximumWidth = nul
if (isValidUrl(imageSource)) {
const base64String = await imageToBase64(imageSource).catch((error) => {
// eslint-disable-next-line no-console
console.warning(`skipping image download and conversion due to ${error}`);
console.warn(`skipping image download and conversion due to ${error}`);
});

if (base64String) {
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/xml-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ const buildRun = async (vNode, attributes, docxDocumentInstance) => {
requiresConversion = true
const base64String = await imageToBase64(imageSource).catch((error) => {
// eslint-disable-next-line no-console
console.warning(`skipping image download and conversion due to ${error}`);
console.warn(`skipping image download and conversion due to ${error}`);
});
if (base64String) {
isConverted = true;
Expand Down Expand Up @@ -1427,7 +1427,7 @@ const buildParagraph = async (vNode, attributes, docxDocumentInstance) => {
if (isValidUrl(imageSource)) {
base64String = await imageToBase64(imageSource).catch((error) => {
// eslint-disable-next-line no-console
console.warning(`skipping image download and conversion due to ${error}`);
console.warn(`skipping image download and conversion due to ${error}`);
});

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

if (base64String && getMimeType(imageSource, base64String)) {
Expand Down

0 comments on commit db5fa73

Please sign in to comment.