Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnkiefer/html2notebook
Convert static HTML files to notebooks
https://github.com/mnkiefer/html2notebook
cap-notebook html jupyter-notebook note notebook
Last synced: about 1 month ago
JSON representation
Convert static HTML files to notebooks
- Host: GitHub
- URL: https://github.com/mnkiefer/html2notebook
- Owner: mnkiefer
- License: mit
- Created: 2023-06-14T21:22:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-20T06:34:38.000Z (about 1 year ago)
- Last Synced: 2024-04-24T12:25:17.400Z (7 months ago)
- Topics: cap-notebook, html, jupyter-notebook, note, notebook
- Language: TypeScript
- Homepage: https://mnkiefer.github.io/html2notebook/
- Size: 398 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# html2notebook
**html2notebook** is a conversion tool that let's you translate _HTML_ to [notebooks](#supported-notebook-formats).
| Notebook type | File extension | Supported |
| :------------------------------------------------------------------------: | :------------: | :-------: |
| [CAP Notebook](https://cap.cloud.sap/docs/tools/#cap-vscode-notebook) | .capnb | ✓ |
| [Jupyter Notebook](https://docs.jupyter.org/en/latest/#what-is-a-notebook) | .ipynb | ✓ |## Installation
```sh
npm install html2notebook
```## Usage
Let's consider we have the following file _test.html_ as input:
```html
TEXT N2
CODE N5
TEXT N11
TEXT N6
TEXT N8
CODE N9
```
To generate a type _Jupyter_ notebook:
```js
const { html2notebook } = require("html2notebook");const html = fs.readFileSync("test.html", "utf8");
const nb = html2notebook(html);console.log(nb);
```This produces the following output:
```swift
{
"metadata": {
"language_info": {
"name": "python"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"attachments": {},
"metadata": {},
"cell_type": "markdown",
"source": [
"",
"","
"",
" TEXT N2",
"",",
" ",
"
"
]
},
{
"metadata": {},
"execution_count": null,
"outputs": [],
"cell_type": "code",
"source": [
"CODE N5",
" "
]
},
{
"attachments": {},
"metadata": {},
"cell_type": "markdown",
"source": [
""",",
"TEXT N6",
"
"",
" ",
"TEXT N8",
"
]
},
{
"metadata": {},
"execution_count": null,
"outputs": [],
"cell_type": "code",
"source": [
"CODE N9"
]
},
{
"attachments": {},
"metadata": {},
"cell_type": "markdown",
"source": [
"",",",
"
"
""
]
}
]
}
```