Search code examples
javascriptprettier

Prettier to format string vars


I need a code editor to display and edit html code in my vue.js project. I have the html codes in DB and I need to format it before displays. I know prettier can do that with function prettier.format() but I am unable to achieve that. If any one knows how to do this or another way or technology would be appreciated.

PS: Only found how to format .vue files but no how to use prettier.format in browser.


Solution

  • This documentation page describes how to use Prettier in the browser: https://prettier.io/docs/en/browser.html

    Feel free to ask questions in the comments if something isn't clear there.