johno / gulp-remarkable

A gulp wrapper for the remarkable markdown parser (CommonMark spec).
MIT License
10 stars 3 forks source link

Add support for plugins. #8

Open johno opened 9 years ago

tcoopman commented 9 years ago

I would love this too!

johno commented 9 years ago

Absolutely, just going to wait for a few more plugins to hit npm so there's something to test against!

tcoopman commented 9 years ago

Will this work with unpublished plugins too?

johno commented 9 years ago

Yep. It will, hypothetically, take any function. The proposed API for plugins:

var gulp = require('gulp'),
    name = require('gulp-rename'),
    md = require('gulp-remarkable'),
    somePlugin = require('some-plugin'),
    unpublishedPlugin = require('./path/to/plugin');

gulp.task('md', function() {
  return gulp.src('file.md')
    .pipe(md({
      preset: 'full',
      plugins: [somePlugin, unpublishedPlugin]
    }))
    .pipe(name('file.html'))
    .pipe(gulp.dest('dist'));
});

gulp.task('default', ['md']);

That way, whether you're installing the plugin from npm, or from a local module, it's all just passed in as an array.

tcoopman commented 9 years ago

Looks good :+1:

johno commented 9 years ago

:smiley:

puzrin commented 9 years ago

@johnotander , switch to markdown-it, it's much more fresh and supports curring.

Instead of adding tons of option, just extend prototype with .gulp() method. So, use will look like this:

var md = require('gulp-markdown-it'); // just returns markdown-it with extended prototype
// ...
  .pipe(md(options).enable(...).disable(...).use(...).gulp())

That's much more easy and compatible with all future changes.

jbnv commented 8 years ago

+1

xcatliu commented 7 years ago

@puzrin Seems gulp-markdown-it doesn't have an API like you have write

var md = require('gulp-markdown-it'); // just returns markdown-it with extended prototype
// ...
  .pipe(md(options).enable(...).disable(...).use(...).gulp())
puzrin commented 7 years ago

@xcatliu i think it's better to ask author or write your own. I'm not familiar well with gulp - don't use it in my projects. I can help only with questions about markdown-it.

caraya commented 7 years ago

@johnotander has there been any traction on this?