# cml-html-converter

> Convert CML To HTML

Latest version **1.3.4** (published 2016-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install cml-html-converter
pnpm add cml-html-converter
yarn add cml-html-converter
bun add cml-html-converter
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2016-02-14 |
| First published | 2016-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matt Huntington |
| Maintainers | mahuntington |
| Keywords | CML |

## Links

- npm: https://www.npmjs.com/package/cml-html-converter
- Repository: https://github.com/mahuntington/cml-html-converter
- Homepage: https://github.com/mahuntington/cml-html-converter#readme
- Issues: https://github.com/mahuntington/cml-html-converter/issues
- npm.io page: https://npm.io/package/cml-html-converter

## Recent versions

- 1.3.4 (latest) — 2016-02-14
- 1.3.3 — 2016-02-14
- 1.3.2 — 2016-01-28
- 1.3.1 — 2016-01-28
- 1.3.0 — 2016-01-27
- 1.2.0 — 2016-01-27
- 1.1.2 — 2016-01-26
- 1.1.1 — 2016-01-26
- 1.1.0 — 2016-01-26
- 1.0.1 — 2016-01-24
- 1.0.0 — 2016-01-23

## README

# CML To HTML Converter

## What is CML?
Check out [the spec!](http://contextual-markup-language.org/)

## What does this library do?
This NPM library is just a single function that implements the CML spec by converting a string of CML into HTML.

## How do I use it?
- Install it using NPM: `npm install cml-html-converter`
- require the module, then call it (example code is best read in github readme.  NPM has issues with tabs).
```javascript
var converter = require('cml-html-converter');
var exampleString = "if the first line contains a line break after it, it is rendered as a header\n" +
"\n" +
"sub headings are single lines that have a line break before and after them, but are not the first line\n" +
"\n" +
"This single line contains a period.  Therefore, it is rendered as a paragraph.  It also contains a link to http://www.google.com, so that is rendered appropriately.\n"+
"\n" +
"lines that either directly preceed another line of text\n" + 
"	or directly succeed another line of text\n" +
"		are rendered as lists\n" +
"			they can also contain links http://www.google.com\n" +
"				you can only forward indent\n" +
"					one tab\n" + 
"						at a\n" +
"							time\n" +
"				but you can back indent as much as you'd like\n" +
"\n" +
"sub heading 2\n";
var htmlString = converter(exampleCMLString); 
```
- in the example above `htmlString` should look something like this:
```html
<h1>if the first line contains a line break after it, it is rendered as a header</h1>
<h2>sub headings are single lines that have a line break before and after them, but are not the first line</h2>
<p>This single line contains a period.  Therefore, it is rendered as a paragraph.  It also contains a link to <a href="http://www.google.com">http://www.google.com</a>, so that is rendered appropriately.</p>
<ul>
	<li>
		lines that either directly preceed another line of text
		<ul>
			<li>
				or directly succeed another line of text
				<ul>
					<li>
						are rendered as lists
						<ul>
							<li>
								they can also contain links <a href="http://www.google.com">http://www.google.com</a>
								<ul>
									<li>
										you can only forward indent
										<ul>
											<li>
												one tab
												<ul>
													<li>
														at a
														<ul>
															<li>
																time
															</li>
														</ul>
													</li>
												</ul>
											</li>
										</ul>
									</li>
									<li>
										but you can back indent as much as you'd like
									</li>
								</ul>
							</li>
						</ul>
					</li>
				</ul>
			</li>
		</ul>
	</li>
</ul>
<h2>sub heading 2</h2>
```

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