Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

violetadev
Copy link
Collaborator

This closes #21

@violetadev
Copy link
Collaborator Author

Please review if the code is correct. I didn't know how to implement the test based on the markdownit and markdown gulp plugins 🆘

@violetadev violetadev added the help wanted Extra attention is needed label Sep 12, 2018
Copy link
Owner

@hagenburger hagenburger left a 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.

@@ -0,0 +1,29 @@
'use strict';
Copy link
Owner

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.

const pimd = require('pimd');

module.exports = options => {
options = options || {};
Copy link
Owner

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.

Copy link
Collaborator

@benevbright benevbright Sep 17, 2018

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.

"version": "0.0.0",
"description": "PIMD Gulp Plugin",
"license": "MIT",
"repository": "hagenburger/pimd/gulp-pimd",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not valid.

"node": ">=6"
},
"scripts": {
"test": "xo && ava"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

@@ -0,0 +1,27 @@
# gulp-pimd

> Markdown to HTML with [`PIMD`](https://github.com/hagenburger/pimd)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove >

@@ -0,0 +1 @@

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

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

@benevbright benevbright added the work in progress This pull request is not ready to merge but open for feedback label Sep 23, 2018
@violetadev violetadev removed help wanted Extra attention is needed work in progress This pull request is not ready to merge but open for feedback labels Sep 23, 2018
Copy link
Owner

@hagenburger hagenburger left a 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.

const { Document } = require("pimd")

module.exports = options => {
return through.obj(function(file, enc, cb) {
Copy link
Owner

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.

@@ -0,0 +1,36 @@
{
"name": "gulp-pimd",
Copy link
Owner

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.

"version": "0.0.0",
"description": "PIMD Gulp Plugin",
"license": "MIT",
"repository": "artnerdnet/pimd/plugins/gulp-pimd/",
Copy link
Owner

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.

npm install --save-dev gulp-pimd
```


Copy link
Owner

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.


gulp.task('default', () =>
gulp.src('intro.md')
.pipe(pimd())
Copy link
Owner

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.

}

describe("gulp-pimd", () => {
it("should render markdown if a buffer is provided.", function(done) {
Copy link
Owner

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)

@@ -0,0 +1,38 @@
const assert = require("assert")
const File = require("vinyl")
var gulpPimdPlugin = require(".")
Copy link
Owner

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).

@benevbright
Copy link
Collaborator

benevbright commented Sep 29, 2018

Seems like Travis issue is fixed.
So please rebase to latest master if you had trouble because of Travis.
#70

cb to callback
var to const
fixed typos
Removed typos
const through = require("through2")
const PluginError = require("plugin-error")
const { Document } = require("pimd")

Copy link
Collaborator

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

@violetadev
Copy link
Collaborator Author

@hagenburger can you check if this is good or if I should change something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gulp plugin
3 participants