Skip to content
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

CLI usage? #39

Open
zmoon opened this issue Mar 3, 2022 · 3 comments
Open

CLI usage? #39

zmoon opened this issue Mar 3, 2022 · 3 comments

Comments

@zmoon
Copy link

zmoon commented Mar 3, 2022

I am wondering about CLI usage. Some things in the repo make it sound like there is or was CLI support to render and open notebook in browser, but I couldn't figure out how to do that with npx. Is it possible?

@jsvine
Copy link
Owner

jsvine commented Mar 4, 2022

Hi @zmoon, and thanks for your interest in this library. When I wrote the main part of the code, npx wasn't on my radar, unfortunately. I imagine that it'd be possible to add that functionality, and I'd welcome a PR that provides it. In the meantime, you can see an example of a small script that provides command-line rendering here: https://github.com/jsvine/notebookjs/blob/master/bin/cli-render.js

... the usage of which would be: node cli-render.js < my-notebook.ipynb > my-notebook.html

@surajsharma
Copy link

... the usage of which would be: node cli-render.js < my-notebook.ipynb > my-notebook.html

unfortunately this will not work, you can try though.

@jsvine
Copy link
Owner

jsvine commented Mar 2, 2024

unfortunately this will not work

Thanks, @surajsharma — it appears you are correct. The JavaScript ecosystem has evolved quite a bit since that code was written, and it now throws an Error [ERR_REQUIRE_ESM]: require() of ES Module error on this line of notebook.js:

var lib = root.ansi_up || (typeof require === "function" && require("ansi_up"));

Unfortunately, although I see the benefits of updating this library for modern JavaScript, it is not enormously high on my todo list. If anyone would like to take a crack at it, I'd be happy to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants