# markdown-api-parser

> Parsing markdown files made easy

Latest version **1.0.5** (published 2015-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-api-parser
pnpm add markdown-api-parser
yarn add markdown-api-parser
bun add markdown-api-parser
```

## 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.5 |
| Published | 2015-12-11 |
| First published | 2015-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | veiset |
| Maintainers | veiset |

## Links

- npm: https://www.npmjs.com/package/markdown-api-parser
- Repository: https://github.com/veiset/markdown-api-parser
- Homepage: https://github.com/veiset/markdown-api-parser#readme
- Issues: https://github.com/veiset/markdown-api-parser/issues
- npm.io page: https://npm.io/package/markdown-api-parser

## Dependencies (4)

- [q](https://npm.io/package/q.md) ^1.4.1
- [glob](https://npm.io/package/glob.md) ^5.0.15
- [event-stream](https://npm.io/package/event-stream.md) ^3.3.1
- [stream-reduce](https://npm.io/package/stream-reduce.md) ^1.0.3

## Recent versions

- 1.0.5 (latest) — 2015-12-11
- 1.0.4 — 2015-10-14
- 1.0.3 — 2015-10-13
- 1.0.2 — 2015-10-13
- 1.0.1 — 2015-10-13
- 1.0.0 — 2015-10-13

## README

# markdown-api-parser

Takes markdown files and generates a data set suitable for using as an API.

## Install

`npm install markdown-api-parser`

## Usage

For ES2015 / ES6:

```js
import { processFiles } from 'markdown-api-parser';
processFiles('example/markdown/*.md').then(data => console.log(data));
```

ES5:

```js
var processFiles = require('markdown-api-parser').processFiles;
processFiles('example/markdown/*.md').then(function(data) { console.log(data) });
```


### Input

**markdown/example.md**

```md
<!---
name: First!
tags: test, blog
published: 19.02.2015, 18:45
-->
# Welcome to my blog
Hello
```

**markdown/example2.md**

```md
<!---
name: Example 2
-->
# Example 2
```

### Output

```js
[ 
  { 
    file: 'markdown/example.md',
    data: '# Welcome to my blog\nHello\n',
    name: [ 'First!' ],
    tags: [ 'test', 'blog' ],
    published: [ '19.02.2015', '18:45' ] 
  },
  { 
    file: 'markdown/example2.md',
    data: '# Example 2\n',
    name: [ 'Example 2' ] 
  } 
]
```


## Custom parser

```js
import { processFiles } from 'markdown-api-parser';

function countLines(filename, content) {
    const lines = content.toString('utf8').split('\n').length;
    return {filename, lines};
};

processFiles('example/markdown/*.md', countLines).then(d => console.log(d));
```

### Example output

```js
[ 
  { filename: 'markdown/example.md', lines: 7 },
  { filename: 'markdown/example2.md', lines: 4 } 
]
```

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