<%* const input = tp.file.selection().match(/!\[\[(.*?)\]\]/g); if (!input || input.length === 0) { tR = "⚠️ No image embeds selected."; return; } const images = input.map(x => x.match(/!\[\[(.*?)\]\]/)[1]); const layout = await tp.system.prompt("Enter layout as <items-per-row>:<rows>"); if (!layout || !layout.includes(":")) { tR = "⚠️ Invalid layout input."; return; } const [cols, rows] = layout.split(":").map(Number); const zoomable = await tp.system.prompt("Should images be zoomable? (yes/no)"); const altAttr = zoomable.toLowerCase().startsWith("y") ? ` alt="click-zoom"` : ""; let output = "<table>\n"; for (let r = 0; r < rows; r++) { output += " <tr>\n"; for (let c = 0; c < cols; c++) { const idx = r * cols + c; const img = images[idx]; if (img) { output += ` <td><img src="${img}"${altAttr} /></td>\n`; } else { output += " <td></td>\n"; } } output += " </tr>\n"; } output += "</table>"; tR = output; %>