# styleguide-generator

> Components oriented, Markdown styleguide generator

Latest version **0.6.3** (published 2015-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install styleguide-generator
pnpm add styleguide-generator
yarn add styleguide-generator
bun add styleguide-generator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.3 |
| Published | 2015-09-15 |
| First published | 2015-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Ugo Onali |
| Maintainers | onaliugo |
| Keywords | node, styleguide, webstyleguide, generator, documentation |

## Links

- npm: https://www.npmjs.com/package/styleguide-generator
- Repository: https://github.com/ugogo/styleguide-generator
- Issues: https://github.com/ugogo/styleguide-generator/issues
- npm.io page: https://npm.io/package/styleguide-generator

## Dependencies (4)

- [extend](https://npm.io/package/extend.md) ^2.0.0
- [marked](https://npm.io/package/marked.md) ^0.3.2
- [highlight.js](https://npm.io/package/highlight.js.md) ^8.4.0
- [uo-node-utils](https://npm.io/package/uo-node-utils.md) 0.1.1

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.6.3 (latest) — 2015-09-15
- 0.6.2 — 2015-09-15
- 0.6.1 — 2015-09-14
- 0.6.0 — 2015-09-09
- 0.5.0 — 2015-07-06
- 0.4.0 — 2015-05-18
- 0.3.0 — 2015-03-06
- 0.2.5 — 2015-02-10
- 0.2.41 — 2015-02-06
- 0.2.40 — 2015-02-06
- 0.2.4 — 2015-02-05
- 0.2.31 — 2015-01-29
- 0.2.30 — 2015-01-28
- 0.2.3 — 2015-01-27
- 0.2.23 — 2015-01-22
- … 4 more at https://npm.io/package/styleguide-generator/versions

## README

# Styleguide generator

## Install
```
npm install --save-dev styleguide-generator
```



## How it works

- Each `.md` files into your `opts.files.src` will be convert (files extension can be change in `opts.components.extension`)
- Files will be output to `opts.files.dist`. If `opts.type: 'components'`, files will be output in `opts.files.dist + opts.components.wrap`
- An example will be automatically generate before code blocks. If you don't want it, set `esc` as language.



## Usage example

### Files

```
.project/
—— css/
———— dropdown/
—————— dropdown.css
—————— dropdown.md
———— modal.css
———— modal.md
—— styleguide/
———— layout.html
———— generate.js
```

### generate.js

```js
// ...

new styleguide({
  files: {
    src: '../css'
    dist: '../dist'
  },
  type: 'onepage',
  layout: 'layout.html'
})
.generate();

// ...
```



## Default options

```js
var defaultOpts = {

  /* files {}

   * files.src: 'string'
   * folder where your .md files are located

   * files.dist: 'string'
   * where your files will be output

   * files.colors: 'string' | false
   * path to your colors file

   * files.ignore: []
   * array to strings to ignore
   */

	files: {
		src: 'assets/css/',
		dist: 'dist',
		colors: 'assets/css/_colors.scss',
    	ignore: ['myIgnoredFile.md', 'myIgnoredFolder/', 'myIgnoredString']
	},

  /* components {}

   * components.wrap: 'string'
   * wrap your components into a folder, can be blank

   * components.extension: 'string'
   * specify your components files extension
   * but files will be compiled in html (for now)

   * components.beforeCompilation: function
   * modify each .md file before compilation
   * must return a string

   * components.afterCompilation: function
   * modify each converted file after compilation
   * must return a string
   */

	components: {
		wrap: 'components/',
    	extension: 'html',
		beforeCompilation: function (str) {
			return str;
		},
		afterCompilation: function (str) {
			return str;
		}
	},

  /* type: 'string' -> 'components' || 'onepage'
   * generate a file per component
   * or a single page */

	type: 'components',

  /* onepage {}
   * onepage options

   * onepage.layout: 'string'
   * path to your layout (for onepage)

   * onepage.stylesheets: []
   * array of css files (will be inline in head) */

  onepage: {
    layout: layout: 'styleguide-layout.html',
    stylesheets: ['path/to/styleguide.css']
  },

  /* silent: boolean
   * log a message when action is done
   * -> uo-node-utils package */

	silent: false

  /* json: false || path to dist folder
   * generate a json with components
   * { components: [...] } */

	json: false
};
```



## Extract components

```js
  var styleguide = new Styleguide({
    ...
  });

  styleguide.generate(function (data) {
    var components = data.components;
  });

  // or
  var components = styleguide._getComponents();
```



## EventEmitter

```js
  var styleguide = new Styleguide({
    ...
  });

  styleguide.on('myEvent', function () {
    ...
  });

  styleguide.emit('myEvent', {
    ...
  });
```



# The MIT License (MIT)

Copyright (c) 2015 Ugo Onali (http://twitter.com/onaliugo)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

---
_Source: https://npm.io/package/styleguide-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
