<commit_before>[gulp](http://gulpjs.com)-markdown-to-json
==========================================

[![CircleCI Status][circleci-badge]][circleci]
[![Semistandard Style][semistandard-badge]][semistandard]

> Parse Markdown + YAML, compile Markdown to HTML, wrap it in JSON.

The neutral format of JSON opens new possibilities for your handcrafted content. Send it onward to other plugins such as [gulp-hb][hb]. When their powers combine, you get a static site generator! Pipe to [request][request] to send it to a [search index][algolia] or [import into a CMS][contentful]. Write a plugin to [tap into the stream][plugin] if you need a client library.

Table of Contents
-----------------

- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)

Install
-------

```bash
npm install gulp-markdown-to-json --save-dev
```

### Dependencies

This plugin does not bundle any Markdown parser to keep your options open. BYOM!

Pick one of these or write a new parser for fun!

- [commonmark.js][commonmark.js]
- [markdown-js][markdown-js]
- [markdown-it][markdown-it] ← the best
- [marked][marked]
- [remark][remark]
- [remarkable][remarkable]

Install, configure, and pass a rendering method to this plugin with a source string as it’s first argument. Output goes straight into the JSON file’s `body` property. If your parser requires instantiation pass a context to call it with by defining `context` in the config object. If yet more hoop jumping is required, write a wrapper function such as this example for remark:

```js
function render (string) {
  const remark = require('remark');
  const html = require('remark-html');
  return remark().use(html).process(string).toString();
}
```

> **Note:**
> YAML frontmatter blocks are stripped and handled before Markdown rendering with [front-matter][front-matter]

Usage
-----

**`/gulpfile.js`**

```javascript
const gulp = require('gulp');<commit_msg>Fix English syntax: changed it's to its<commit_after>[gulp](http://gulpjs.com)-markdown-to-json
==========================================

[![CircleCI Status][circleci-badge]][circleci]
[![Semistandard Style][semistandard-badge]][semistandard]

> Parse Markdown + YAML, compile Markdown to HTML, wrap it in JSON.

The neutral format of JSON opens new possibilities for your handcrafted content. Send it onward to other plugins such as [gulp-hb][hb]. When their powers combine, you get a static site generator! Pipe to [request][request] to send it to a [search index][algolia] or [import into a CMS][contentful]. Write a plugin to [tap into the stream][plugin] if you need a client library.

Table of Contents
-----------------

- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)

Install
-------

```bash
npm install gulp-markdown-to-json --save-dev
```

### Dependencies

This plugin does not bundle any Markdown parser to keep your options open. BYOM!

Pick one of these or write a new parser for fun!

- [commonmark.js][commonmark.js]
- [markdown-js][markdown-js]
- [markdown-it][markdown-it] ← the best
- [marked][marked]
- [remark][remark]
- [remarkable][remarkable]

Install, configure, and pass a rendering method to this plugin with a source string as its first argument. Output goes straight into the JSON file’s `body` property. If your parser requires instantiation pass a context to call it with by defining `context` in the config object. If yet more hoop jumping is required, write a wrapper function such as this example for remark:

```js
function render (string) {
  const remark = require('remark');
  const html = require('remark-html');
  return remark().use(html).process(string).toString();
}
```

> **Note:**
> YAML frontmatter blocks are stripped and handled before Markdown rendering with [front-matter][front-matter]

Usage
-----

**`/gulpfile.js`**

```javascript
const gulp = require('gulp');
{'fraction_non_alphanumeric': 0.15312101910828024, 'fraction_numerical': 0.0, 'mean_word_length': 4.61659513590844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5156366', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1108, 'n_words': 443}