gulp-markdown-to-json
gulp-markdown-to-json copied to clipboard
Outputs json converted *.md files no *.json or wont compile into single *. json?
The gulp task returns *.md no *.json output the code is below,
Thanks for your help
const gulp = require('gulp')
const marked = require('marked')
const listStream = require('list-stream');
marked.setOptions({
pedantic: true,
smartypants: true
})
gulp.task('markdown-json', () => {
gulp.src([
'./src/packages/**/**/*.md',
'!./src/packages/**/node_modules/**/*.md'
])
.pipe(jsonMarkdown(marked))
.pipe(gulp.dest('dist/docs/json/'))
})
single output file task/config
gulp.task('markdown-json', () => {
gulp.src([
'./src/packages/**/**/*.md',
'!./src/packages/**/node_modules/**/*.md'
])
.pipe(listStream.obj())
.pipe(jsonMarkdown(marked))
.pipe(gulp.dest('dist/docs/json/'))
})
I have the same issue. Everything works correctly but the file extension of the output file is .md rather than .json.
I forgot to say, the gulp-rename package can probably help here:
https://www.npmjs.com/package/gulp-rename
var rename = require('gulp-rename')
gulp.task('markdown-json', () => {
gulp.src([
'./src/packages/**/**/*.md',
'!./src/packages/**/node_modules/**/*.md'
])
.pipe(jsonMarkdown(marked))
.pipe(rename({ extname: '.json' }))
.pipe(gulp.dest('dist/docs/json/'))
})
I'm using it for something else but it should be a simple solution.
Appears this bug was introduced in v1.1.0. Going back to v1.0.3 fixes this. (gulp-rename is also a solution)