# @jamen/markdown-to-code

> A literate programming tool using markdown and its codeblocks.

Latest version **0.2.0** (published 2019-01-29) · 0 weekly downloads

## Install

```sh
npm install @jamen/markdown-to-code
pnpm add @jamen/markdown-to-code
yarn add @jamen/markdown-to-code
bun add @jamen/markdown-to-code
```

Provides the command `markdown-to-code`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-01-29 |
| First published | 2018-06-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jamen Marz |
| Maintainers | jamen |

## Links

- npm: https://www.npmjs.com/package/@jamen/markdown-to-code
- npm.io page: https://npm.io/package/@jamen/markdown-to-code

## Recent versions

- 0.2.0 (latest) — 2019-01-29
- 0.1.0 — 2018-06-28

## README

# @jamen/markdown-to-code

A [literate programming][1] tool using markdown and codeblocks.  It turns codeblocks into source code and the rest of the content into comments, allowing you to execute or analyze only the code.

## Install

```
npm i @jamen/markdown-to-code
```

Or quickly use command-line utility:

```sh
npx @jamen/markdown-to-code foo.md foo.js
```

## Usage

### `markdownCode(options?)`

Compiles an `input` stream with the given options, returns a readable stream.

```js
let compileMarkdown = markdownCode({
    language: 'js',
    mode: {
        opener: '/**',
        normal: ' * ',
        closer: ' **/'
    }
})

createReadStream('input.md')
.pipe(compileMarkdown)
.pipe(createWriteStream('output.js'))
```

### `markdown-to-code <input> <output>`

Command-line tool that compiles the input file to the output file. Uses stdio without files.

Use `--mode` or `-m` to set the commenting mode (see [lib/modes.json](lib/modes.json)).

To opt-in or opt-out of codeblocks turning into code, you use HTML comments above them containing the word "export".  By default this is an opt-in behavior, but you can use the `--all` or `-a` flag to make it opt-out (everything is exported)

[1]: https://en.wikipedia.org/wiki/Literate_programming

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