# markdown-cli-compiler

> Converts a markdown file to an HTML one using markdown-it and a lot of plugins.

Latest version **0.1.1** (published 2021-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-cli-compiler
pnpm add markdown-cli-compiler
yarn add markdown-cli-compiler
bun add markdown-cli-compiler
```

Provides the command `mdc`.

## Health

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

Positive: no vulnerabilities.

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

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-03-02 |
| First published | 2021-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 38 |
| Unpacked size | 20.5 KB |
| Known vulnerabilities | 0 (+6 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | catonif |
| Maintainers | catonif |
| Keywords | markdown, markdown-it, cli, html |

## Links

- npm: https://www.npmjs.com/package/markdown-cli-compiler
- Repository: https://github.com/catonif/markdown-cli-compiler
- Homepage: https://github.com/catonif/markdown-cli-compiler/
- Issues: https://github.com/catonif/markdown-cli-compiler/issues/
- npm.io page: https://npm.io/package/markdown-cli-compiler

## Dependencies (38)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [path](https://npm.io/package/path.md) ^0.12.7
- [katex](https://npm.io/package/katex.md) ^0.12.0
- [yargs](https://npm.io/package/yargs.md) ^16.2.0
- [markdown-it](https://npm.io/package/markdown-it.md) ^12.0.4
- [highlight.js](https://npm.io/package/highlight.js.md) ^10.6.0
- [yargs-parser](https://npm.io/package/yargs-parser.md) ^20.2.5
- [markdown-it-ins](https://npm.io/package/markdown-it-ins.md) ^3.0.1
- [markdown-it-jsx](https://npm.io/package/markdown-it-jsx.md) ^1.1.0
- [markdown-it-kbd](https://npm.io/package/markdown-it-kbd.md) ^2.2.0
- [markdown-it-sub](https://npm.io/package/markdown-it-sub.md) ^1.0.0
- [markdown-it-sup](https://npm.io/package/markdown-it-sup.md) ^1.0.0
- [markdown-it-toc](https://npm.io/package/markdown-it-toc.md) ^1.1.0
- [markdown-it-abbr](https://npm.io/package/markdown-it-abbr.md) ^1.0.4
- [markdown-it-emph](https://npm.io/package/markdown-it-emph.md) ^1.1.0
- [markdown-it-mark](https://npm.io/package/markdown-it-mark.md) ^3.0.1
- [markdown-it-ruby](https://npm.io/package/markdown-it-ruby.md) git+https://github.com/catonif/markdown-it-ruby.git
- [markdown-it-attrs](https://npm.io/package/markdown-it-attrs.md) ^4.0.0
- [markdown-it-color](https://npm.io/package/markdown-it-color.md) ^2.1.0
- [markdown-it-emoji](https://npm.io/package/markdown-it-emoji.md) ^2.0.0
- [markdown-it-small](https://npm.io/package/markdown-it-small.md) ^1.0.0
- [markdown-it-title](https://npm.io/package/markdown-it-title.md) ^3.0.0
- [markdown-it-anchor](https://npm.io/package/markdown-it-anchor.md) ^7.0.2
- [markdown-it-classy](https://npm.io/package/markdown-it-classy.md) ^0.2.0
- [markdown-it-imsize](https://npm.io/package/markdown-it-imsize.md) ^2.0.1
- [markdown-it-deflist](https://npm.io/package/markdown-it-deflist.md) ^2.1.0
- [markdown-it-spoiler](https://npm.io/package/markdown-it-spoiler.md) ^1.1.1
- [markdown-it-texmath](https://npm.io/package/markdown-it-texmath.md) ^0.8.0
- [markdown-it-codetabs](https://npm.io/package/markdown-it-codetabs.md) ^1.2.0
- [markdown-it-footnote](https://npm.io/package/markdown-it-footnote.md) ^3.0.2
- [markdown-it-underline](https://npm.io/package/markdown-it-underline.md) ^1.0.1
- [markdown-it-task-lists](https://npm.io/package/markdown-it-task-lists.md) ^2.1.1
- [markdown-it-center-text](https://npm.io/package/markdown-it-center-text.md) ^1.0.4
- [markdown-it-collapsible](https://npm.io/package/markdown-it-collapsible.md) ^1.0.0
- [markdown-it-expand-tabs](https://npm.io/package/markdown-it-expand-tabs.md) ^1.0.13
- [markdown-it-smartarrows](https://npm.io/package/markdown-it-smartarrows.md) ^1.0.1
- [markdown-it-multimd-table](https://npm.io/package/markdown-it-multimd-table.md) ^4.0.3
- [markdown-it-inline-comments](https://npm.io/package/markdown-it-inline-comments.md) ^1.0.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

- 0.1.1 (latest) — 2021-03-02

## README

# markdown-cli-compiler
Hello, this readme is a WIP.

## Installation
```
npm i -g markdown-cli-compiler
```

## Usage
```
mdc <args>
```

## CLI arguments
- `--ignore`: boolean. Doesn't run the command. Useful in a `mdconfig.json`.
### File I/O args
- `--input` or `-i`: string. the input file path. Can be a Markdown file or a directory.
- `--output` or `-o`: string. The output path. By default it's the input file name with an additional `.html` extension.
- `--enc`: string. Input Markdown file encoding ([list of supported encodings](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings)). It's also used for the mdconfig.json. **Default**: `utf8`
### Content args
- `--plugins` or `-p`: array. The names of the plugins to use. Works without the `markdown-it-` prefix too. [got from here](https://www.npmjs.com/search?q=keywords:markdown-it-plugin). **eg**: `--plugins mark ins`
- `--styles` or `-s`: array. The paths of the CSS files that will be linked in a `<link>` tag in the head of the output html file. Glob works.
- `--hls`: string. The name of an highlight.js theme ([list of themes](https://github.com/highlightjs/highlight.js/tree/master/src/styles)). **eg**: `--hls monokai`
- `--copiedStyles`: array. The paths of the CSS files whose content will be copied and pasted into the output html. Paths should be relative to the output path. Glob works.
- `--inlineStyle`: string. Raw CSS to write as it is into a `<style>` tag.
- `--title`: string. Goes in the `<title>` tag.
- `--comment`: boolean. Adds to the html output a comment after `<!DOCTYPE html>` with in it the command called with all the args.
### CLI behaviour args
- `--force`: boolean. Doesn't emit a warning before overriding a file. (I wanted the "Are you sure you want to override the file?", but since I haven't made it yet, this doesn't really make sense).
- `--noOk`: boolean. Doesn't emit success messages.
- `--noWarn`: boolean. Doesn't emit warning messages.
- `--failOnWarn`: boolean. Stops the program when encounters a warning.
- `--debug`: boolean. Doesn't quit on fail.
### markdown-it args
- `--html`, `--xhtmlOut`, `--breaks`, `--langPrefix`, `--linkify`, `--typographer` and `--quotes` (all: boolean) are explained [here](https://github.com/markdown-it/markdown-it#readme).

## mdconfig.json
If the input field is a directory, the program will look for a file named `mdconfig.json` there. It has to be an array of json objects with configurations that work the same way as the [cli args](#CLI-arguments). Aliases like `-i`, `-o` and `-s` will not work. [**Example**](https://github.com/catonif/markdown-cli-compiler/blob/main/examples/mdconfig.json).

## Basic usage examples
```powershell
mdc -i .
# compiles the mdconfig.json in the current folder

mdc -i test.md --enc latin1 --typographer
# compiles test.md with latin1 into test.md.html with utf8 with typographer enabled

mdc -i mathfile.md -o math.html -p texmath ins
# uses the markdown-it-texmath plugin and the markdown-it-ins one, list of avaliable plugins is in the dependency list

mdc -i stylish.md -s ../styles/*.css
# references all the css files in the styles folder in the <link> tag in the html
```

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