Skip to content

Commit f83b8bd

Browse files
authored
Implement replaceInputs function for content processing
Added replaceInputs function to process input text.
1 parent 3b07cc2 commit f83b8bd

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

script.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ function handleInput() {
466466
let content = input.value;
467467

468468
// content = escapeHTML(content); // yes do put the raw chicken in the salad i love when my app gets xss
469-
content = content;
469+
content = replaceInputs(content);
470470
let parsedHTML = marked.parse(content);
471471

472472
// you don't believe how many hours fixing this took (just to comment it out later)
@@ -614,3 +614,10 @@ function appendErrorMessage(message) {
614614
errorParagraph.textContent = message;
615615
errorOutput.appendChild(errorParagraph);
616616
}
617+
618+
function replaceInputs(text) {
619+
return inputReplacements.reduce((acc, {
620+
regex,
621+
template
622+
}) => acc.replace(regex, template),text);
623+
}

0 commit comments

Comments
 (0)