Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

allow using code-prettify without dom #574

Open
winguse opened this issue Dec 27, 2018 · 0 comments
Open

allow using code-prettify without dom #574

winguse opened this issue Dec 27, 2018 · 0 comments

Comments

@winguse
Copy link

winguse commented Dec 27, 2018

I love this project!

I am wondering if we can export some core functions to allow this project being used in server side project.

Say langHandlerForExtension here: https://github.com/google/code-prettify/blob/master/src/node_prettify.js#L1302

Now I simply make a private patch to make it work in my scenario.

diff --git a/src/node_prettify.js b/src/node_prettify.js
index df8d026..f69d10b 100644
--- a/src/node_prettify.js
+++ b/src/node_prettify.js
@@ -117,6 +117,7 @@ var prettyPrintOne;
  */
 var prettyPrint;

+var exportedLangHandlerForExtension;

 (function () {
   var win = (typeof window !== 'undefined') ? window : {};
@@ -1699,12 +1700,15 @@ var prettyPrint;
       return PR;
     });
   }
+
+  exportedLangHandlerForExtension = langHandlerForExtension;
 })();


 var path = require('path');

 module.exports = {
+  exportedLangHandlerForExtension,
   prettyPrint: prettyPrint,
   prettyPrintOne: prettyPrintOne,
   // include paths for css preprocessor support

It will be great if this is official supported.

@winguse winguse changed the title allow using code pretty without dom allow using code-prettify without dom Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant