open-index/open-npm huggingface dataset:
npm package: @smartcodelab/ngx-prettify
Description: > This is Angular (version 6+) Service providing utility of Code Formating. > This uses the core "pretty" Javascript Module for formatting HTML Code; > Currently this library supports only HTML, Javascript and CSS code;  >  > Dependencies : npm modules pr
Latest version: 0.0.6

# @smartcodelab/ngx-prettify

> This is Angular (version 6+) Service providing utility of Code Formating.
> This uses the core "pretty" Javascript Module for formatting HTML Code;
> Currently this library supports only HTML, Javascript and CSS code; 
> 
> Dependencies : npm modules pretty and js-beautify


## Installation

Install pretty and @smartcodelab/ngx-prettify library. Use Below commands:

```bash
$ npm install pretty js-beautify @smartcodelab/ngx-prettify --save
or
$ yarn add pretty js-beautify @smartcodelab/ngx-prettify
```

## Consuming @smartcodelab/ngx-prettify library

>The Service is created with providedIn set to 'root' by default; 
>So only installation of NPM Module is only required. So not necessary to add to any Module >imports explicitly in the NgModule.

In .ts file

```typescript
import { Component } from '@angular/core';
import { NgxPrettifyService } from '@smartcodelab/ngx-prettify';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent  {
  code = `
  <!DOCTYPE html><title>Title</title><style>body {width: 500px;}</style>
  <script type="application/javascript">function $init() {return true;}</script>
  <body><p checked class="title" id='title'>Title</p>
    <!-- here goes the rest of the page --></body>`;

  constructor( public prettifier: NgxPrettifyService) {
    // Below Code prettifies html code content in 'code' variable.
    this.code = this.prettifier.prettify(this.code);
  }
}

```

## License

MIT

[npm-url]: https://www.npmjs.com/package/@smartcodelab/ngx-prettify