Metadata-Version: 2.5
Name: jupyter_tables
Version: 0.2.0
Summary: Visual Markdown table editor with LaTeX quick-insert helpers and RTL support for JupyterLab 4 and Notebook 7
Project-URL: Homepage, https://github.com/yarden-has/jupyter_tables
Project-URL: Repository, https://github.com/yarden-has/jupyter_tables
Project-URL: Issues, https://github.com/yarden-has/jupyter_tables/issues
Author: Yarden Hasenfrats
License: BSD 3-Clause License
        
        Copyright (c) 2026, yarden-has
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Keywords: jupyter,jupyterlab,jupyterlab-extension,latex,markdown,notebook,rtl,tables
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 4
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# jupyter_tables

Visual Markdown table editor with LaTeX quick-insert helpers, live MathJax preview, and automatic RTL/LTR support for **JupyterLab 4** and **Jupyter Notebook 7**.

Edits are saved directly as standard Markdown pipe tables inside the `.ipynb` file — **no extra data files** and **no extension required for readers/graders** opening the notebook later.

![jupyter_tables workflow demo](https://raw.githubusercontent.com/yarden-has/jupyter_tables/main/docs/images/demo-workflow.gif)

---

## Features

- **Visual Grid Editor:** Edit existing Markdown tables or create new ones without fighting `|` column alignment or bidirectional text cursor jumps.
- **Seamless RTL & Math Support:** Automatically detects Hebrew/Arabic text and switches input direction per cell (`dir="rtl"` for RTL text, `dir="ltr"` for `$...$` math and numbers), with a toolbar toggle (`Direction: LTR` / `Direction: RTL`).
- **LaTeX Quick-Insert Bar:** One-click insertion of `±`, `Val ± Err` (`$\pm{}$`), `\times 10^{}`, fractions, roots, superscripts/subscripts, Greek symbols, and an inline `$...$` toggle.
- **Live MathJax Preview:** See rendered Markdown and typeset equations in real time as you type.
- **Spreadsheet Paste & Keyboard Navigation:** Paste multi-cell selections directly from Excel, Google Sheets, or TSV tables; move across cells with `Tab`, `Shift+Tab`, `Enter`, and arrow keys.
- **Standard `.ipynb` Output:** Writes clean, properly escaped Markdown back into the cell (automatically escaping `|` inside math such as `$|F|$` so cells never split unexpectedly).

---

## Requirements

- Python `>= 3.9`
- **JupyterLab `>= 4.0`** or **Jupyter Notebook `>= 7.0`**

---

## Installation

### Install from PyPI (recommended)

```bash
pip install jupyter-tables
```

*(Installing as `pip install jupyter_tables` also works identically; no Node.js required.)*

### Alternative: Install from a local wheel or from source

**From a local `.whl` file:**

```bash
pip install path/to/jupyter_tables-0.2.0-py3-none-any.whl
```

**From source** (requires Node.js `>= 20` and Python `>= 3.9`):

```bash
git clone https://github.com/yarden-has/jupyter_tables.git
cd jupyter_tables
npm install
npm run build
pip install .
```

### Verify & Uninstall

Confirm JupyterLab / Notebook sees the enabled extension:

```bash
jupyter labextension list
```

Expected output includes:

```text
jupyter_tables v0.2.0 enabled ok (python, jupyter_tables)
```

To uninstall:

```bash
pip uninstall jupyter_tables
```

---

## Usage & Demonstrations

### 1. Opening or Inserting a Table

You can launch the editor from any notebook in three ways:

- Click the **`Table`** button in the notebook toolbar.
- Click **`Edit Table`** directly above any rendered Markdown table.
- Press **`Alt+Shift+T`** while inside a notebook.

If the active cell already contains a Markdown table (or is an empty Markdown cell), saving updates that cell in place. Otherwise, saving inserts a new Markdown cell right below the active cell.

![Notebook toolbar button and Edit Table overlay](https://raw.githubusercontent.com/yarden-has/jupyter_tables/main/docs/images/toolbar-and-overlay.png)

### 2. Editing Cells, LaTeX Quick-Inserts, and Live Preview

Use the LaTeX bar to insert snippets at the cursor position of the focused cell. If the cursor is outside math delimiters, snippets are wrapped in `$...$` automatically (for example, clicking **`Val ± Err`** inserts `$\pm{}$`).

![Visual Markdown Table Editor with LaTeX quick-insert bar and live MathJax preview](https://raw.githubusercontent.com/yarden-has/jupyter_tables/main/docs/images/editor-modal-ltr.png)

Available quick-insert buttons:

| Button | Inserts | Notes |
|---|---|---|
| `±` | `\pm ` | Plus-minus symbol |
| `Val ± Err` | `\pm{}` | Wraps as `$\pm{}$` outside math; places cursor before `\pm` in an empty cell or inside `{}` after a value |
| `×10ⁿ` | `\times 10^{}` | Scientific notation |
| `a/b` | `\frac{}{}` | Fraction |
| `√` | `\sqrt{}` | Square root |
| `xⁿ` / `xₙ` | `^{}` / `_{}` | Superscript / subscript |
| `δ`, `Δ`, `μ`, `σ`, `ρ`, `π`, `°`, `⟨x⟩` | Corresponding LaTeX command | Auto-wrapped in `$...$` if outside math |
| `$...$` | Toggles `$...$` | Wraps/unwraps the whole cell or current selection |

### 3. Working with RTL Languages (Hebrew / Arabic) + Math

When a table contains RTL characters (or `<div dir="rtl">`), the editor automatically enables **`Direction: RTL`**. Each grid cell picks its editing direction smartly (`dir="rtl"` for Hebrew/Arabic text, `dir="ltr"` for `$...$` math and numbers) so mixed-direction typing stays predictable, and toggling **`Direction: RTL` / `Direction: LTR`** wraps or unwraps `<div dir="rtl">` when saving.

![RTL Hebrew and LaTeX table editing with live RTL preview](https://raw.githubusercontent.com/yarden-has/jupyter_tables/main/docs/images/editor-modal-rtl-latex.png)

### 4. Keyboard Shortcuts & Spreadsheet Paste

| Action | Shortcut / Gesture |
|---|---|
| Open table editor | `Alt+Shift+T` |
| Next / previous cell | `Tab` / `Shift+Tab` |
| Move down (or add a new row at the bottom) | `Enter` |
| Move up / down | `ArrowUp` / `ArrowDown` |
| Paste multi-cell range from Excel, Google Sheets, or TSV | `Ctrl+V` / `Cmd+V` (automatically expands rows and columns) |

---

## Development & Testing

```bash
# Install JS dependencies and run TypeScript + unit tests
npm install
npx tsc
npm test

# Build the federated JupyterLab extension into jupyter_tables/labextension/
npm run build

# Build the redistributable Python wheel into dist/
uv build --wheel
# (or: python -m pip wheel --no-deps --no-build-isolation . -w dist)
```

---

## License

BSD-3-Clause
