sojournerc / gulp-markdown-docs

Turn markdown and yaml into a navigable documentation page
23 stars 10 forks source link

Error message when running with "yamlMeta: false" #1

Closed DanielSundberg closed 9 years ago

DanielSundberg commented 9 years ago

When running with option "yamlMeta: false" I get an error message:

> gulp markdownDocs
[14:56:01] Using gulpfile C:\myPath\gulpfile.js
[14:56:01] Starting 'markdownDocs'...
C:\myPath\node_modules\gulp-markdown-docs\index.js:136
tions.documentSort === 'rank' ? child.meta.documentRank : child.meta.documentL
                                                                ^
TypeError: Cannot read property 'documentLabel' of null
    at C:\myPath\node_modules\gulp-markdown-docs\index.js:136:82
    at C:\myPath\node_modules\gulp-markdown-docs\node_modules\lodash\dist\lodash.js:4031:47
    at forEach (C:\myPath\node_modules\gulp-markdown-docs\node_modules\lodash\dist\lodash.js:3298:15)
    at Function.sortBy (C:\myPath\node_modules\gulp-markdown-docs\node_modules\lodash\dist\lodash.js:4026:7)
    at C:\myPath\node_modules\gulp-markdown-docs\index.js:135:26
    at Array.forEach (native)
    at sortDocs (C:\myPath\node_modules\gulp-markdown-docs\index.js:134:14)
    at Stream.endStream (C:\myPath\node_modules\gulp-markdown-docs\index.js:170:21)
    at _end (C:\myPath\node_modules\gulp-markdown-docs\node_modules\through\index.js:65:9)
    at Stream.stream.end (C:\myPath\node_modules\gulp-markdown-docs\node_modules\through\index.js:74:5)

Markdown docs version:

>npm view gulp-markdown-docs version
0.1.1

Gulpfile.json:

var markdownDocs = require('gulp-markdown-docs');
var gulp = require('gulp');
gulp.task('markdownDocs', function () {
  return gulp.src('./Frontend/docs/test/*.md')
    .pipe(markdownDocs('index.html', {  
        yamlMeta: false
    }))
    .pipe(gulp.dest('./documentation/'));
});

Docs folder content:

> ls Frontend/docs/test/
noYaml-orphan.md

noYaml-orphan.md:

# No YAML header

This is the body

When using a header everything work as expected.

aminalhazwani commented 9 years ago

I get the same error as well.

sojournerc commented 9 years ago

Thanks @DanielSundberg, @aminalhazwani - I've pushed a fix and bumped the version. Should be good in v0.1.2.