From 5c20d49bb7e5c49ec67f24f18e74b87b58e2e1be Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sat, 13 Apr 2024 18:51:24 -0700 Subject: [PATCH] ext: Add md passthrough --- brevmakesjupyterlookbetter/__init__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/brevmakesjupyterlookbetter/__init__.py b/brevmakesjupyterlookbetter/__init__.py index 2a417bf..6a80c1e 100644 --- a/brevmakesjupyterlookbetter/__init__.py +++ b/brevmakesjupyterlookbetter/__init__.py @@ -1,8 +1,31 @@ from ._version import __version__ +import os +import json +import tornado +from jupyter_server.base.handlers import JupyterHandler + def _jupyter_labextension_paths(): return [{ "src": "labextension", "dest": "brevmakesjupyterlookbetter" }] + + +def _jupyter_server_extension_paths(): + return [{ + "module": "brevmakesjupyterlookbetter" + }] + + +class BMJLBExtensionHandler(JupyterHandler): + def get(self): + # print VERB_ env vars: + self.finish(json.dumps({ + k: v for k, v in os.environ.items() if k.startswith("VERB_") + })) + +def _load_jupyter_server_extension(serverapp): + handlers = [("/brevmakesjupyterlookbetter", BMJLBExtensionHandler)] + serverapp.web_app.add_handlers(".*$", handlers)