Skip to content
Snippets Groups Projects
Commit 79b5cb37 authored by Quentin Bramas's avatar Quentin Bramas
Browse files

anti cheat

parent 6aeadc9c
Branches
Tags
No related merge requests found
Pipeline #351943 passed with stages
in 1 minute and 2 seconds
......@@ -24,6 +24,7 @@ const insertHiddenTextBetweenChars = (markdown, hiddenText) => {
// Split the markdown text into an array of characters
const chars = markdown.split('');
let inCodeBlock = false;
let inMathBlock = false;
let processedChars = [];
for (let i = 0; i < chars.length; i++) {
......@@ -35,9 +36,14 @@ const insertHiddenTextBetweenChars = (markdown, hiddenText) => {
processedChars.push(char);
continue;
}
if (char === '$') {
inMathBlock = !inMathBlock;
processedChars.push(char);
continue;
}
// Only insert hidden text between letters and when not in a code block
if (!inCodeBlock && /[A-Za-z]/.test(char)) {
if (!inCodeBlock && !inMathBlock && /[A-Za-z]/.test(char)) {
processedChars.push(`${char}<span class="hidden-text" style="font-size:0; opacity:0; position:absolute;">${hiddenText}</span>`);
} else {
processedChars.push(char);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment