Giter VIP home page Giter VIP logo

Comments (22)

privateOmega avatar privateOmega commented on June 19, 2024 4

Removed the libtidy dependency.

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024 3

Guys, I am delighted to know that people have noticed my very first OSS package, thanks for the following.
But I am extremely sorry that I haven't been able to spend some time to follow up on the issues created in this repo, being quite busy with my work.
All that apart I was able to spend some time to figure out the issue at hand finally and I have good news and bad news.

Good news - Figured out the problematic dependency and removed it in feature/browser-example branch, a minifier plugin called html-minifier was the culprit. And I tested this out in react environment and it seems to work well, except for some white-spacing issue.
Replacement is plain regex as of now. :/

Bad news - In browser, I am getting an error of an import from html-to-vdom is giving me undefined instead of the function it should be returning, but from some googling I am certain that it is due to a circular dependency, which I will try to resolve ASAP and this should be good to ship for browser usage as well.

Cheers

NB: People who want to try out this change in react, I guess for now you could do

Edit:
Some issue is there with this command npm install git://github.com/privateOmega/html-to-docx.git#feature/browser-example
Try yarn add git://github.com/privateOmega/html-to-docx.git#feature/browser-example

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024 2

@BikashKNayak @anirudh-modi Sorry for the late reply, I haven't been following this project as much as I would like to due to other commitments. The problem with implementing this package in browser is exactly like @josx said, I started working on this project with an aim to support both ends of the stack but I had to import node-libtidy into the package which essentially cleans up HTML and only works in node environment. Since I have multiple people interested in this being implemented at browser, I will try to work on the package ASAP, removing node-libtidy dependency and supporting browsers. Anyone who is interested can also take this up.

from html-to-docx.

evrardts avatar evrardts commented on June 19, 2024 2

Same here, would love to see it working in the browser. Thanks a lot!

from html-to-docx.

wnabil avatar wnabil commented on June 19, 2024 2

@privateOmega i got Cannot call a class as a function using the latest version 1.2.2 when tsconfig is targeting es5
import * as HTMLtoDOCX from 'html-to-docx'; or import HTMLtoDOCX from 'html-to-docx'; const HTMLtoDOCX = require('html-to-docx'); did not help

the project have to target ES2015 then it will work.

from html-to-docx.

tenthousandfiRe avatar tenthousandfiRe commented on June 19, 2024 1

I'm interested on how this can work with browser

from html-to-docx.

redbrain avatar redbrain commented on June 19, 2024 1

+1 for browser support. I'll comment so I'm notified of progress.

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024

@QQCif Currently this project was made targeting both Node and Frontend frameworks like React, Vue etc. But I will try to add direct browser support ASAP.

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024

Working on this under feature/browser-example

from html-to-docx.

BikashKNayak avatar BikashKNayak commented on June 19, 2024

I installed this in my react typescript application but gives node js related errors such as
Error: Can't resolve 'child_process' in \node_modules\libtidy-updated\node_modules\detect-libc\lib'

Is there any specific instructions that need to be followed to use this in React.

from html-to-docx.

anirudh-modi avatar anirudh-modi commented on June 19, 2024

@privateOmega what will be the state of the branch for the browser support? Can we have this feature of browser support?

from html-to-docx.

josx avatar josx commented on June 19, 2024

The problem is:
https://github.com/gagern/node-libtidy dont support browser.

from html-to-docx.

josx avatar josx commented on June 19, 2024

great!

from html-to-docx.

itsmhuang avatar itsmhuang commented on June 19, 2024

Is there any update on how this can work with browser now?

from html-to-docx.

ronanjia avatar ronanjia commented on June 19, 2024

hi, @privateOmega, Help please, sorry i just can't get it to work in browser.
i installed the feature/browser-example branch, and only got '/example' and '/node_modules' 2 directories in my 'html-to-docx' package
image

I thought some key files might be lost, so i copied '/src', '/template', 'index.js' into the package folder, just got the same error of Can't resolve 'crypto', 'fs', 'path' when i run from "generateContainer" in index.js
image

So is it possible to use this package in a react or an angular project for browser?

from html-to-docx.

redbrain avatar redbrain commented on June 19, 2024

hi @ronanjia !
Currently, this project isn't functional in browser, that's why this issue is open. It'll be closed when browser support is released.
Until then, try using another, such as https://github.com/evidenceprime/html-docx-js . Not as good, but browser supported.

from html-to-docx.

ronanjia avatar ronanjia commented on June 19, 2024

hi @ronanjia !
Currently, this project isn't functional in browser, that's why this issue is open. It'll be closed when browser support is released.
Until then, try using another, such as https://github.com/evidenceprime/html-docx-js . Not as good, but browser supported.

Thank you so much for your advice, it really would help!

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024

Guys, I am extremely sorry about turning a blind eye towards this much requested feature for so long, I was so occupied with other things, that I wasn't able to put in any time on this and get this feature out, but today I did spend some time and it seems like there's some issue that I am facing with npm specifically and not yarn and seems like that was the culprit all along and it was misleading me as well when I last worked on this. I will raise a PR now itself after rebasing the branch and hopefully this should be out with next version release.

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024

@ronanjia Thanks a lot for posting this, it helped me find that this happens only when you try installing with npm and not yarn. Could you please try with yarn and post the result here?

yarn add https://github.com/privateOmega/html-to-docx.git#feature/browser-example if you are trying directly from git.

or

yarn add file:../html-to-docx if you are trying with cloned repo and when you are on feature/browser-example branch. Please do change the relative path appropriately.

from html-to-docx.

privateOmega avatar privateOmega commented on June 19, 2024

Finally released a new version which contains the changes for browser support, even though it doesn't have support for direct usage using script tag, but it does work with React, so yay. :D

Closing this issue.

from html-to-docx.

artemdumanov avatar artemdumanov commented on June 19, 2024

As a workaround, you can use
// @ts-ignore

from html-to-docx.

haykeminyan avatar haykeminyan commented on June 19, 2024

could you check please this error with doc/docx?
ERROR Export type is not supported.
I can't export data into docx... changed es2020 to es2015 and seems no changes. All other types are working except doc/docx(

from html-to-docx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.