StyleGuideDoc is a standard for documenting living style guides like these.
Syntax
Documenting style guide components is as easy as writing Markdown. Components can be documented in dedicated Markdown files:
---name: Buttoncategory: Components--- Buttons can be used with `<a>`, `<button>`, and `<input>` elements. Types of buttons:- Default: Standard button- Primary: Provides extra visual weight and identifies the primary action in a set of buttons- Success: Indicates a successful or positive action ```types.html<button class="btn btn-default">Default</button><button class="btn btn-primary">Primary</button><button class="btn btn-success">Success</button>```
…or as comment blocks within any source code:
/*---name: Buttoncategory: Components--- Buttons can be used with `<a>`, `<button>`, and `<input>` elements. Types of buttons:- Default: Standard button- Primary: Provides extra visual weight and identifies the primary action in a set of buttons- Success: Indicates a successful or positive action ```types.html<button class="btn btn-default">Default</button><button class="btn btn-primary">Primary</button><button class="btn btn-success">Success</button>```*/
In both cases, the output will be the same.
For more details and examples, see the full StyleGuideDoc spec.
Installation
Available on npm:
npm install styleguidedoc# or yarn add styleguidedoc
Usage
docs = styleguidedoc
Name | Type | Description |
---|---|---|
content |
string | File content |
syntax |
string | File extension |
Returns a list of docs extracted from content
.
Example
Extracts components from a CSS file.
var fs = ;var styleguidedoc = ; var content = fs;var syntax = 'md';var docs = styleguidedoc; console;
Outputs: