# marko2html

> Generate a HTML file from a Marko template

Latest version **1.0.0** (published 2016-06-17) · MIT license · 0 weekly downloads

## Install

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

Provides the command `marko2html`.

## 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.0.0 |
| Published | 2016-06-17 |
| First published | 2016-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.10.1 |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kiley Hykawy |
| Maintainers | kileyhykawy |
| Keywords | marko, html |

## Links

- npm: https://www.npmjs.com/package/marko2html
- Repository: https://github.com/kileyhykawy/marko2html
- Homepage: https://github.com/kileyhykawy/marko2html#readme
- Issues: https://github.com/kileyhykawy/marko2html/issues
- npm.io page: https://npm.io/package/marko2html

## Dependencies (5)

- [glob](https://npm.io/package/glob.md) ^7.0.4
- [marko](https://npm.io/package/marko.md) ^3.5.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [debug-logger](https://npm.io/package/debug-logger.md) ^0.4.1

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-06-17
- 0.0.1 — 2016-06-15

## README

# marko2html
Generate a HTML file from a Marko template

## Installation
```sh
$ npm install -g marko2html
```

## Usage
```
  Usage: marko2html [options] <template> <datafile>

  Options:

    -o, --outfile [path_to_file]  specify output file location (default is stdout),
    -d, --outdir [path_to_dir]    specify output directory
    -i, --ignore [glob]           glob spec of templates to ignore
```

Data files can either be JSON (.json) for static data or Javascript (.js) for dynamic data. Example of .js file:
```js
module.exports = {
  data1: "value1",
  data2: {
    data3: "value3",
    data4: "value4"
  }
};
```

### Render a single template file
You can use marko2html with a single template file and single data file output to either
an output file or stdout.

```sh
$ marko2html [-o <output_file>] <template_file> <data_file>
```

Render the template `template.marko` with data from `template.json` and
**output to stdout**
```sh
$ marko2html template.marko template.json
# output...
```

If you would like to **output to a file** you may use `--outfile` or `-o`.
```sh
$ marko2html --outfile template.html template.marko template.json
```

### Templates from a folder
You can also pass marko2html a directory of templates where it recursively processes all
.marko files in that location. It reads data from the given data directory that shadows
the directory structure and file naming of the template directory. The rendered HTML files are written to
the specified output directory and matches the structure of the template directory.

Example:
Template directory `mytemplates/`
```
mytemplates
|-- template1.marko
|-- subdir/
    |-- template2.marko
```

Data directory `templatedata/`
```
templatedata
|-- template1.[json|js]
|-- subdir/
    |-- template2.[json|js]
```

Output directory `generated/`
```
generated
|-- template1.html
|-- subdir/
    |-- template2.html
```

Render the templates in directory `marko` with data from `data` and output to `html`
```sh
$ marko2html marko/ data/ -d html/
```

You can also ignore files/directories found in the template folder by passing in globs
```sh
$ marko2html marko/ data/ -d html/ -i "**/_*.marko" -i "**/default_layout.marko"
```

## License
[MIT](LICENSE)

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