Open SilentImp opened 5 years ago
Hi, I am parsing frontend articles and want to beautify snippets of code inside.
Unfortunately, Unibeautify must run within Node.js on a server, it does not work within the browser.
npm package with api would be awesome.
Unibeautify is already a npm package: https://yarnpkg.com/en/package/unibeautify 🎉
it fails on some nasty piece of code from time to time.
Can you provide some more details of what you're doing? Ideally, a repository we could build ourselves locally and following https://stackoverflow.com/help/mcve .
Unfortunately, Unibeautify must run within Node.js on a server, it does not work within the browser.
Yes, I want to run it exactly that way. On node.js server. Not in the browser.
Unibeautify is already a npm package
It provides CLI utility. I need to run it from my node.js script without using CLI. Is it possible?
Can you provide some more details of what you're doing?
That was about https://www.npmjs.com/package/prettier package. I actually may, but I have a filling you somehow got me wrong.
@SilentImp I think what you want is https://www.npmjs.com/package/unibeautify. You can call the methods in there using node. Docs here: https://api.unibeautify.com/
@stevenzeck oh, look like you are right. Main problem was (is) documentation and lack of examples in the main readme.md.
If you also add the link to an example of how I may beautify string of code — I will be totally happy. But thank you kindly in any case.
https://github.com/Unibeautify/vscode/blob/master/src/EditProvider.ts#L52-L86 is a good example. Mainly https://github.com/Unibeautify/vscode/blob/master/src/EditProvider.ts#L80-L83, you'll see that's where unibeautify
calls the beautify
method with the data (text, language, options, etc).
Thank you!
@SilentImp : Pull Requests improving README are very welcome!
Is your feature request related to a problem? Please describe. Hi, I am parsing frontend articles and want to beautify snippets of code inside. But I have no idea how to use it from node.js on a string of code.
Describe the solution you'd like npm package with api would be awesome. how did you do it in the playground?
Describe alternatives you've considered prettier package for example. problem is that I have no idea about snippets language and it fails on some nasty piece of code from time to time.
Additional context