# tms-mdhtml

> convert markdown to HTML

Latest version **1.0.8** (published 2022-06-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install tms-mdhtml
pnpm add tms-mdhtml
yarn add tms-mdhtml
bun add tms-mdhtml
```

Provides the command `mdhtml`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2022-06-25 |
| First published | 2022-03-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 363.3 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | terrymorse |

## Links

- npm: https://www.npmjs.com/package/tms-mdhtml
- npm.io page: https://npm.io/package/tms-mdhtml

## Dependencies (3)

- [prettier](https://npm.io/package/prettier.md) ^2.6.0
- [markdown-it](https://npm.io/package/markdown-it.md) ^12.3.2
- [markdown-it-highlightjs](https://npm.io/package/markdown-it-highlightjs.md) ^3.6.0

## Recent versions

- 1.0.8 (latest) — 2022-06-25
- 1.0.7 — 2022-05-30
- 1.0.6 — 2022-05-11
- 1.0.5 — 2022-05-09
- 1.0.4 — 2022-03-25
- 1.0.3 — 2022-03-23

## README

# tms-mdhtml

Convert Markdown to HTML
---

## Install

```bash
npm install tms-mdhtml
```

## Usage

### Command Line:
```bash
mdhtml --src <markdown_file> [...options]
```
options:

`--style <css_file>` - insert _css_file_ contents into style element

`--title "My Title Text"` - insert "_My Title Text_" into title element

`--output <html_file>` - save complete HTML to _html_file_. If not specified, HTML goes to _stdout_.

### JavaScript

```javascript
import { mdToHtmlText, mdToHtmlDocument } from 'tms-mdhtml';

/**
 * convert markdown text to HTML text
 * @param {string} mdText
 * @param {Boolean} [pretty]
 * @return {string}
 */
let htmlPretty = mdToHtmlText("# Hello World", true);

/*
    htmlPretty:
    <h1>Hello World</h1>
 */

/**
 * convert markdown + style + title strings to complete HTML document
 * @param {string} mdContent
 * @param {string} [styleContent]
 * @param {string} [titleContent]
 * @return {string} - complete html document text
 */

let htmlDocument = mdToHtmlDocument (
  "# Hello World",
  "h1 {font-size: 3rem;}",
  "Hello World Title"
);

/*
    htmlDocument:
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <title>Hello World Title</title>
        <style>
          h1 {
            font-size: 3rem;
          }
        </style>
      </head>
      <body>
        <h1>Hello World</h1>
      </body>
    </html>
 */
```

## Resources

- [markdown-it demo](https://markdown-it.github.io)
- [markdown-it README](https://github.com/markdown-it/markdown-it#readme)
- [Syntax Highlighting Themes](https://stylishthemes.github.io/GitHub-Dark/)

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