Skip to content

Commit e37c664

Browse files
authored
Add files via upload
1 parent 61cee4a commit e37c664

20 files changed

Lines changed: 9022 additions & 0 deletions

File tree

Format Table/1.0.0/FormatTable.js

Lines changed: 529 additions & 0 deletions
Large diffs are not rendered by default.

Format Table/FormatTable.js

Lines changed: 529 additions & 0 deletions
Large diffs are not rendered by default.

Format Table/readme.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Format Table
2+
3+
**Format Table** is a Roll20 API script that applies clean, consistent styling to all HTML tables inside a handout. It supports multiple prebuilt style presets tailored for popular tabletop systems and formatting conventions.
4+
5+
---
6+
7+
## Features
8+
9+
- Apply predefined visual styles to handout tables
10+
- One-command formatting for all tables in a handout
11+
- Interactive UI for easy style selection
12+
- Supports multiple RPG systems and generic formats
13+
14+
---
15+
16+
## Usage
17+
18+
### Basic Command (UI Mode)
19+
20+
`!format-table`
21+
22+
Opens an interactive control panel with buttons for each available style. You will be prompted to enter a handout name or ID.
23+
24+
---
25+
26+
### Direct Command
27+
28+
!format-table --style|STYLE --handout|HANDOUT
29+
30+
#### Arguments
31+
32+
- `--style`
33+
Name of the style to apply
34+
35+
- `--handout`
36+
Handout name (case-insensitive) or ID
37+
38+
---
39+
40+
### Example
41+
42+
!format-table --style|5e --handout|Monster Stats
43+
44+
---
45+
46+
### Help Command
47+
48+
!format-table --help
49+
50+
Displays usage instructions and a list of available styles.
51+
52+
---
53+
54+
## Available Styles
55+
56+
The script includes the following built-in styles:
57+
58+
- `5e`
59+
- `5.5e`
60+
- `Wikitable`
61+
- `Pathfinder 2`
62+
- `OSR`
63+
- `DnD 3`
64+
- `Minimal`
65+
- `Invisible`
66+
- `Roll20 Default`
67+
68+
Each style defines:
69+
70+
- Table layout
71+
- Row striping (odd/even)
72+
- Header row formatting
73+
- Cell padding and borders
74+
- Font family and size
75+
76+
---
77+
78+
## Behavior Details
79+
80+
- Processes **all `<table>` elements** in the handout notes.
81+
- Alternates row styling automatically (even/odd).
82+
- First row is treated as a header when defined by the selected style.
83+
84+
---
85+
86+
## Notes & Limitations
87+
88+
- Existing table formatting will be overwritten.
89+
- Only `<td>` elements are styled (`<th>` is not explicitly handled).
90+
- Nested tables may not be processed correctly.
91+
- Requires valid HTML tables in the handout notes.
92+
- Large handouts may take longer to process.
93+
94+
---
95+
96+
## How It Works
97+
98+
- Parses handout HTML using regex to locate `<table>` elements.
99+
- Applies style definitions from a centralized `STYLES` object.
100+
- Converts JavaScript style objects into inline CSS.
101+
- Rewrites table markup with consistent formatting.
102+
103+
---
104+
105+
## Modification
106+
107+
If you import instead of install, so you have access to the code, you can add new styles to the `STYLES` object

Format Table/script.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "Format Table",
3+
"script": "FormatTable.js",
4+
"version": "1.0.0",
5+
"description": "Displays a chat menu for auto-formatting handout tables with a variety of presets resembling those used by popular game systems. Supports 5.5e, 5e, DnD 3, Invisible, Minimal, OSR, Pathfinder 2, Roll20 Default, Wikitable",
6+
"authors": "Keith Curtis",
7+
"roll20userid": "162065",
8+
"modifies": {
9+
"handout": "read,write"
10+
},
11+
"dependencies": [],
12+
"conflicts": [],
13+
"previousversions": ["1.0.0"]
14+
}

0 commit comments

Comments
 (0)