leeoniya / reMarked.js

client-side HTML > markdown
http://leeoniya.github.io/reMarked.js/
396 stars 97 forks source link

Publish to NPM? #38

Open KyleAMathews opened 10 years ago

KyleAMathews commented 10 years ago

I'd love to use this in a current node.js project. Looks much nicer than the few other similar modules that are available.

leeoniya commented 10 years ago

There are a couple issues, though neither is insurmountable.

  1. reMarked has a dependency on https://www.npmjs.org/package/klass which is currently copied/pasted at the bottom of reMarked.js. For those who already just use the single file, things will break if i pull klass out and only add it as a dependency in package.json. I could of course leave things the way they are, but would prefer a nice way to migrate existing users.
  2. reMarked needs the DOM for some things, so i'll need to add https://github.com/tmpvar/jsdom as a dep also. There is some boilerplate for it that i havent had a chance to look through yet, so that'll need to be done as well.
leeoniya commented 10 years ago

i did some preliminary npm-ification work at https://github.com/leeoniya/reMarked.js/tree/npm-package

leeoniya commented 10 years ago

i guess one way could be to include a copy klass.js in the repo and do something like importScripts() (à la Web Workers) if a klass is not detected.

leeoniya commented 10 years ago

i think i've fixed 1) in https://github.com/leeoniya/reMarked.js/commit/1c852c2749877329909fd54c0f6e3a4a8a3e1827

haohcraft commented 10 years ago

I think you can do like this

https://github.com/haohcraft/reMarked.js/compare/npm-package

leeoniya commented 10 years ago

i wanted to avoid a dependency on require itself, which more than doubles the necessary download size. http://requirejs.org/docs/release/2.1.13/minified/require.js

haohcraft commented 10 years ago

I see.

But I use the webpack (https://github.com/webpack/webpack), so the "require" is not actually require.js but "requiring" the module.

marijnh commented 9 years ago

You're using klass once. Would a PR that simply replaces that call with equivalent prototype-mangling code be welcome?

leeoniya commented 9 years ago

@marijnh sure, i'm not married to klass, but i do use its supr methods as well as the prototype chain instanceof testing. it's also really small. if you have something in mind that'll work instead that doesnt involve bloating the code with Object.create and .prototype madness at every .extend() and supr(), i would not be opposed to swapping it out.

to note, breaking klass out as a dependency would require all instances of init: to be changed to initialize: - i wasn't too fond of the supr being oddly shortened and initialize being long.

that being said, i can also just leave it the way it is and call it a day.