Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better usage description #188

Open
muuvmuuv opened this issue Sep 27, 2018 · 3 comments
Open

Better usage description #188

muuvmuuv opened this issue Sep 27, 2018 · 3 comments

Comments

@muuvmuuv
Copy link

muuvmuuv commented Sep 27, 2018

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);
  });
@muuvmuuv
Copy link
Author

Related to: #102

@lassik
Copy link
Contributor

lassik commented Oct 1, 2018

Could we have an examples directory in the repo with some sample code? We could start with a very minimal example as @muuvmuuv wrote above. Example sourcefiles would have the benefit that they are runnable directly.

Of course, if there's a predecent in the Node JS community of laying out documentation and examples in a different way, then we should follow that convention (I'm sure you know better than me).

@Glavin001
Copy link
Member

Open to receiving Pull Requests enhancing the documentation and developer experience 😃 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants