Skip to content

Commit

Permalink
Fix text highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodwyer committed Oct 24, 2023
1 parent cd0cbd8 commit a7a4b7b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions assets/src/scripts/_file-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ export function createImageElement(el, url) {
export async function createTextElement(el, ext, url) {
const data = await fileLoader(ext, url);

const textEl = document.createElement("pre");
const textEl = document.createElement("code");
textEl.classList.add(
"break-words",
"text-sm",
`language-${highlightJsName(ext)}`
);
textEl.innerText = data;
textEl.innerHTML = data;

el.appendChild(textEl);
const preEl = document.createElement("pre");
preEl.appendChild(textEl);
el.appendChild(preEl);

hljs.highlightAll();
}
Expand Down

0 comments on commit a7a4b7b

Please sign in to comment.