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

allow using code-prettify without dom #574

Open

Description

@winguse

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.

Activity

  1. changed the title [-]allow using code pretty without dom[/-] [+]allow using code-prettify without dom[/+] on Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions