Closed fliiiix closed 10 years ago
Can you confirm you used markdown-browser-0.6.0-beta1.tgz and not the non browser version?
Ups sorry, never mind :unamused: I got the wrong file in my first try.
I had the same issue with the markdown-browser-0.6.0-beta1.tgz package. It would seem that the non-minified version is not the correct one. The minified file works though.
http://cdnjs.com/libraries/markdown.js
The cdnjs version of this is the node version, not the browser version, so exports comes up as not defined.
@SimpleAsCouldBe I'm not sure who uploaded the version to cdnjs.com - it wasn't me or one of the other authors. Do you know who/how to contact to find out?
It looks like a fork+pull+request operation: https://github.com/cdnjs/cdnjs#adding-a-new-or-updating-an-existing-library
Any reason you don't use UMD or similar so that the builds are the same between node and browser? I imagine there are other blockers besides the module pattern used?
Didn't know there was a ritual roasters in London, @ashb
There isn't - I was out in SF when I snapped the pic and I liked it so much it became my avatar. Not least in part to mess with people I know in SF ;)
Hmm might be that a release to npm is all that is needed...?
As for UMD: I gave up years ago trying to figure out what module loaders work where and what the syntax was. Node worked, and including the file directly in a browser worked - that filled my need. If you can come up with a pull request that does UMD tidily without extra deps then we'll take it.
But mainly I despair at having to change my library to support another module loading format when module exports already exists and works :(
All the module formats can be annoying. I remember loving AMD while I was using it, but now I'm on Angular and that's a sloppy fit. Can't wait for ES6 and some standardization in the module space.
I think the only thing blocking the node version from working in browser is the exports
keyword, isn't it? That UMD page is intimidatingly large, but I think it pretty much just shims define
and exports
so that AMD, CommonJS, and vanilla all work. Might be this simple:
if (typeof exports === 'object') {
module.exports = MarkdownJS;
} else {
window.MarkdownJS = MarkdownJS;
}
I'm sorry I don't PR it, but I don't have any immediate pain here, lack the server-side test case and experience, and won't get to share in the glory, fame, and riches that core contributors enjoy :)
What is the solution here? Where is the version that works in browsers? The CDNJS version still doesn't work in browsers after all this time.....
I added this version to my app on October 5th. Happy hunting
I think this is mainly because exports is somewhere used. The error I got in my browser console is: