https://github.com/cxa/ob-js-node-eval
JS code block results with node evaluation for org-babel-js
https://github.com/cxa/ob-js-node-eval
Last synced: 3 months ago
JSON representation
JS code block results with node evaluation for org-babel-js
- Host: GitHub
- URL: https://github.com/cxa/ob-js-node-eval
- Owner: cxa
- Created: 2023-10-29T12:24:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T16:09:23.000Z (over 2 years ago)
- Last Synced: 2025-01-12T14:45:53.191Z (over 1 year ago)
- Language: Emacs Lisp
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ob-js-node-eval
Evaluate JavaScript snippets in Org Babel directly with Node.js, without any wrappers like the official implementation.
``` org
#+begin_src js :results node-eval :module esm
console.log('hello, world!')
#+end_src
```
The `:module` argument is optional if the script can be auto-detected as ESM (currently, detection only checks for the presence of `import` in the code. Handling top-level `await` would require more complex methods, which are not practical for such a small helper. Therefore, you must specify it explicitly with the `:module` argument if needed).
## Installation
Add `ob-js-node-eval.el` to your `load-path`, or use a package manager like `use-package`:
```elisp
(use-package ob-js-node-eval
:vc (:url "https://github.com/cxa/ob-js-node-eval"))
```