Skip to content

Better usage description #188

@muuvmuuv

Description

@muuvmuuv

In the README.md We should better describe the usage. So everyone better understands how to implement this. Something Like:

"First you need to import Unibeautify and load a beautifier to it, so Unibeautify can use beautifier to beautify your text/file that you give it later. Next you need to specfiy some options, have a look here [LINK] to see all available options for the beautifier and language. After that you pass the test/file to the beautifier and wait for the result."

import { Unibeautify } from "unibeautify";
import beautifier from "@unibeautify/beautifier-eslint";

const unibeautify = Unibeautify();

unibeautify.loadBeautifier(beautifier);

const text = `if (foo) {bar();} else {baz();}`;

unibeautify
  .beautify({
    languageName: "JavaScript",
    options: {
      JavaScript: {
        brace_style: "collapse",
        indent_style: "tab"
      }
    },
    text
  })
  .then(results => {
    console.log(results);
  });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions