diff --git a/assets/src/scripts/_file-elements.js b/assets/src/scripts/_file-elements.js index 4d9bdbab..946a205b 100644 --- a/assets/src/scripts/_file-elements.js +++ b/assets/src/scripts/_file-elements.js @@ -39,7 +39,7 @@ export async function createTextElement(el, ext, url) { const data = await fileLoader(ext, url); const textEl = document.createElement("pre"); - textEl.classList.add("break-words", "text-sm", "whitespace-pre-line"); + textEl.classList.add("break-words", "text-sm"); textEl.innerText = data; el.appendChild(textEl); diff --git a/assets/src/scripts/_utils.js b/assets/src/scripts/_utils.js index 16087ff8..afc6f9c6 100644 --- a/assets/src/scripts/_utils.js +++ b/assets/src/scripts/_utils.js @@ -11,13 +11,14 @@ export const isCsv = (ext) => ext.toLowerCase() === "csv"; export const isImg = (ext) => ["gif", "jpg", "jpeg", "png", "svg"].includes(ext.toLowerCase()); +export const TEXT_TYPES = ["txt", "md", "py", "yaml", "R", "log"]; /** * Confirm if file is .txt * @param {string} ext - file extension * @returns {boolean} */ export function isTxt(ext) { - return ext.toLowerCase() === "txt"; + return TEXT_TYPES.includes(ext.toLowerCase()); } /**