# tbone

> A simple library to generate valid HTML markup.

Latest version **0.2.0** (published 2013-04-21) · 0 weekly downloads

## Install

```sh
npm install tbone
pnpm add tbone
yarn add tbone
bun add tbone
```

## 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.2.0 |
| Published | 2013-04-21 |
| First published | 2012-09-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 0.10.x |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | R. S. Doiel |
| Maintainers | rsdoiel |

## Links

- npm: https://www.npmjs.com/package/tbone
- Repository: http://github.com/rsdoiel/tbone
- Issues: http://github.com/rsdoiel/tbone/issues
- npm.io page: https://npm.io/package/tbone

## Dependencies (1)

- [yui](https://npm.io/package/yui.md) 3.10.x

## Recent versions

- 0.2.0 (latest) — 2013-04-21
- 0.1.5 — 2012-10-12
- 0.1.3 — 2012-10-06
- 0.0.3f — 2012-09-26

## README

[![build status](https://secure.travis-ci.org/rsdoiel/tbone.png)](http://travis-ci.org/rsdoiel/tbone)
TBone
=====

TBone is an small JavaScript library for generating valid HTML. It is based
on an article by Jason Grosman, ["Behind the Code: Avoiding Spaghetti"](http://www.npr.org/blogs/inside/2011/02/02/126312263/behind-the-code-avoiding-spaghetti-html). As of version 0.2.x it has been re-written
as a YUI module (mostly so I can learn YUI's toolchain :-)

# Examples

## NodeJS/Mongo Shell example

### sample-0.js

```JavaScript
    var YUI = require("yui").YUI;

    YUI().use("tbone", function (Y) {
	    var TBone = Y.TBone,
		    markup = new TBone.HTML();

	    // Displaying an HTML 5 valid HTML page.
	    Y.log(markup.html(
		    markup.head(
			    markup.title("Hello World")
		    ),
		    markup.body(
			    markup.h1("Hello World")
		    )
	    ));
    });
```

### sample-1.js

```JavaScript
    YUI().use("tbone", function (Y) {
	    var TBone = Y.TBone,
		    markup = new TBone.HTML();
	
	    //
	    // Generate a simple HTML page.
	    //
	    var markup = new TBone.HTML(),
		    page_source = tbone.html(
			    markup.head(
				    "<!-- Test comment -->",
                    markup.title("Simple 0")
			    ),
			    markup.body(
				    markup.h1("Sample 0"),
				    markup.p("Hello World")
			    )
		    );
	
	    // Display it
	    Y.log(page_source);
    });
```

## sample-2.js

```JavaScript
    YUI().use("tbone", function (Y) {
        var TBone = require("tbone");

        //
        // Generate a simple HTML page.
        //
        var markup = new TBone.HTML(),
	        page_source = markup.html(
		        markup.head(
			        markup.title("Simple 1")
		        ),
		        markup.body(
			        markup.h1("Sample 1").attr({"class": "banner"}),
			        markup.p("Hello Again World").attr({"class": "content"})
		        )
	        );

        // Display it
        Y.log(page_source);
```

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