0.4.4 • Published 6 years ago

seldon v0.4.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

seldon

Nodejs CSS documentation generator inspired by hologram.

This is a work in progress. This project currently works as a simple node script, but don't expect unicorns and rainbows (yet).

1. Use structured comments in your CSS

/*doc

title: My Component Title name: myUniqueComponentName

category: My Category Name

Any markdown you want can go here. Github-flavored markdown supported.

<p>This is a special fenced code block that does neat things:<p>
<ol>
	<li>Put example code here<li>
	<li>It will be rendered directly to static documentation<li>
	<li>Escaped html will appear under the example<li>
<ol>

*/

2. Create a Seldon config file

config.json

{
	"source": "../sq2/sass/",
	"destination": "build/index.html",
	"assets": [
		"templates/static/"
	],
	"templates": {
		"layout": "templates/layout.hbs",
		"example": "templates/example.hbs"
	}
}
PropertyDescription
sourceany dir containing files with structured comments
destinationtarget dir for built docs (will be created if it doesn't exist)
assetsstatic assets you'd like to copy into the destination dir (files will be copied to the root of destination)
templates["layout"]main handlebars template
templates["example"]template used to render html_example blocks

Running Seldon

$ npm install seldon --save-dev
Use as a node module
const Seldon = require('seldon');

Seldon.compile('./config.json');
Use from the command line
$ node seldon.js /path/to/config/config.json

3. Seldon creates a view for handlebars

{
	myCategory: {
		title: "My Category",
		name: myCategory,
		blocks: [ //components filed under this category
			{
				title: "My Component Title",
				name: "myUniqueComponentName",
				description: "(html string compiled from markdown, including html_example blocks)"
			},
			{
				title: "My Other Component in this category",
				name: "myOtherComponent",
				description: "(html string compiled from markdown, including html_example blocks)",
				children: [ /* nesting is supported with the `parent` convention from hologram docs */
					{
						title: "My child component",
						name: "childComponent",
						description: "(html string compiled from markdown, including html_example blocks)",
					}
				]
			}
		]
	}
}

4. Go forth and template

You can write your own handlebars template to use with the data provided by seldon.


Seldon?

This project is named after Hari Seldon, a fictional character in Isaac Asimov's Foundation.

In the series, Seldon is a pivotal figure who appears only in hologram form.

Special thanks to the good folks at Trulia who wrote hologram, the tool that inspired this project.

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago