-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#21 Gulp plugin #54
base: master
Are you sure you want to change the base?
#21 Gulp plugin #54
Conversation
Please review if the code is correct. I didn't know how to implement the test based on the markdownit and markdown gulp plugins 🆘 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure, Prettier gets the correct coding style.
I’ll think about the name and maybe come back to you.
plugins/gulp-pimd/index.js
Outdated
@@ -0,0 +1,29 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line. This is outdated JavaScript and not needed anymore.
plugins/gulp-pimd/index.js
Outdated
const pimd = require('pimd'); | ||
|
||
module.exports = options => { | ||
options = options || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Options need to be a Config
object for PIMD. But as PIMD generates it automatically, no default value needs to be assigned when empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artnerdnet asked me to help to understand this review.
When you look pimd/lib/document.js
, Document class generate Config
instance automatically when config
, the second parameter is null.
class Document {
constructor(source, config) {
this.source = source
this.config = config || new Config()
...
So, if you generate the default options
value({}
) there and use it as the second parameter, it will make an unexpected result than not having the second parameter.
plugins/gulp-pimd/package.json
Outdated
"version": "0.0.0", | ||
"description": "PIMD Gulp Plugin", | ||
"license": "MIT", | ||
"repository": "hagenburger/pimd/gulp-pimd", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems not valid.
plugins/gulp-pimd/package.json
Outdated
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
plugins/gulp-pimd/readme.md
Outdated
@@ -0,0 +1,27 @@ | |||
# gulp-pimd | |||
|
|||
> Markdown to HTML with [`PIMD`](https://github.com/hagenburger/pimd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove >
@@ -0,0 +1 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check this?
https://github.com/trwolfe13/gulp-markdownit/blob/master/spec/index.spec.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hagenburger yes but I don't understand it fully :< I looked also at markdown and the tutorial in the gulp site
6874656
to
45ec3d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @artnerdnet, this is a first review I’ve done by reading the code. I also have to check it out locally.
plugins/gulp-pimd/index.js
Outdated
const { Document } = require("pimd") | ||
|
||
module.exports = options => { | ||
return through.obj(function(file, enc, cb) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename cb
to callback
, please? The first time I saw this years ago, it took me a while to understand cb
. I would like to have the code easy to read if possible.
plugins/gulp-pimd/package.json
Outdated
@@ -0,0 +1,36 @@ | |||
{ | |||
"name": "gulp-pimd", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indentation doesn’t follow our coding standards. Please reformat with Prettier.
plugins/gulp-pimd/package.json
Outdated
"version": "0.0.0", | ||
"description": "PIMD Gulp Plugin", | ||
"license": "MIT", | ||
"repository": "artnerdnet/pimd/plugins/gulp-pimd/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a valid repository URL. Please copy from other package.json
.
plugins/gulp-pimd/readme.md
Outdated
npm install --save-dev gulp-pimd | ||
``` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indentation doesn’t follow our coding standards. Please reformat with Prettier.
plugins/gulp-pimd/readme.md
Outdated
|
||
gulp.task('default', () => | ||
gulp.src('intro.md') | ||
.pipe(pimd()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pimd
is not defined. Please check the code example.
plugins/gulp-pimd/test.js
Outdated
} | ||
|
||
describe("gulp-pimd", () => { | ||
it("should render markdown if a buffer is provided.", function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- “Markdown” is a name and should use title case
- Remove the period (same for the next test case)
plugins/gulp-pimd/test.js
Outdated
@@ -0,0 +1,38 @@ | |||
const assert = require("assert") | |||
const File = require("vinyl") | |||
var gulpPimdPlugin = require(".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use const
(or let
if needed).
Seems like Travis issue is fixed. |
79f01f9
to
b71f673
Compare
cb to callback
var to const fixed typos
Removed typos
const through = require("through2") | ||
const PluginError = require("plugin-error") | ||
const { Document } = require("pimd") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we add allinc-plugin
for gulp-pimd
by default?
@hagenburger @artnerdnet
@hagenburger can you check if this is good or if I should change something else? |
This closes #21