-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Publish on npm #12
Comments
No, as I have no idea how to do that :P |
@jzaefferer How would that work exactly, given Prism.js heavily relies on (non-ECMAScript) DOM extensions for most of its core methods? |
@mathiasbynens no idea, haven't looked at the code yet, but that sounds like it would become a problem. Though jsdom, or even better yet, cheeriosjs, might help there: https://github.com/MatthewMueller/cheerio |
@mathiasbynens The heart of Prism is |
@LeaVerou Oh, that’s good news, then! |
https://github.com/LeaVerou/prism/blob/gh-pages/prism.js#L300 would need to be changed before this script could run in node without a |
Also usage of |
Hi folks, I've done some work to adapt the current prism.js code to work within a node context, as well as the browser. To see the changes involved, have a look at the following branch / diff for the details: Diff: https://github.com/buymeasoda/prism/compare/npm-node-support This version allows you to do the following:
I've included a sample Although this adaption is working fine for providing The plugins that work in a node (non-browser) context, have also had a couple of minor changes to allow them to work. For example, Show Invisibles and Autolinker are both usable scripts in a node context. Let me know what you think and if there's anything else I can do to help. |
Based on feedback from Lea, I've created a new version of this pull request that includes the bare minimum needed to get Prism functioning in node. The pull request is: #42 |
Based on further discussion, a new version has been submitted that creates a dedicated node version of prism.js. The pull request is: #45 |
This can be closed since #179 was merged, right? |
I think so :) |
This looks like it would be useful to run serverside via node.js. Could you add a package.json and publish on npm?
The text was updated successfully, but these errors were encountered: