From 2a37cda2449b625bc49014a63e5bcef8bcab45ff Mon Sep 17 00:00:00 2001 From: Bobby Date: Mon, 21 Mar 2022 05:00:10 -0400 Subject: Auto add table styles --- static/assets/js/pages/publish.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/assets/js/pages/publish.js b/static/assets/js/pages/publish.js index 7349fac..cc3c9c1 100644 --- a/static/assets/js/pages/publish.js +++ b/static/assets/js/pages/publish.js @@ -8,6 +8,12 @@ window.addEventListener("DOMContentLoaded", () => { }); content.addEventListener("input", () => { renderPreview.innerHTML = marked.parse(content.value); + // Find all tables and add class to them + const tables = document.getElementsByTagName("table"); + for (let i = 0; i < tables.length; i++) { + tables[i].classList.add("table"); + tables[i].classList.add("table-bordered"); + } renderMathInElement(renderPreview, { // customised options // • auto-render specific keys, e.g.: -- cgit v1.2.3