remark-merge
v0.0.3
Published
Remark plugin to get all images from `markdown` as an `array` and optionally update/replace them
Maintainers
Readme
remark-merge
remark plugin to merge two or more consecutive
blockquoteorcodeelements into one
Installation
npm install remark-merge --saveUsage
Say we have the following file, example.md:
# Title
Content...
> Quote text 1
> Quote text 2
Some paragraph...
> Quote text 3
Another paragraph...
> Quote text 4
> Quote text 5
> Quote text 6
More paragraphs...
```javascript
const param1 = true
```
```javascript
const param2 = true
```
```javascript
const param3 = true
```
Another paragraph
```javascript
const param4 = true
```
```javascript
const param5 = true
```
Anoter paragraph
```javascript
const end = true
```
Last paragraphAnd our script, example.js, looks as follows:
const vfile = require('to-vfile')
const remark = require('remark')
const merge = require('remark-merge')
const options = {
types: ['blockquote', 'code'],
devider: null,
}
const markdown = remark()
.use(merge, options)
.process(vfile.readSync('example.html'), function (err, file) {
if (err) throw err
console.log(String(file))
})Now, running node example yields:
# Title
Content...
> Quote text 1
>
> Quote text 2
Some paragraph...
> Quote text 3
Another paragraph...
> Quote text 4
>
> Quote text 5
>
> Quote text 6
More paragraphs...
```javascript
const param1 = true
const param2 = true
const param3 = true
```
Another paragraph
```javascript
const param4 = true
const param5 = true
```
Anoter paragraph
```javascript
const end = true
```
Last paragraphIf devider option is provided, then merged blocks will be devided with provided string (in our example it's ---):
...
> Quote text 4
>
> ---
>
> Quote text 5
>
> ---
>
> Quote text 6
More paragraphs...
```javascript
const param1 = true
---
const param2 = true
---
const param3 = true
```
...Options
types-array- One of the defaults, or both. Default is[ 'blockquote', 'code' ]devider-string- Sting that will devide blocks. Line break will be ignored. Default is empty string.
