Okay so I have made a few posts like this basically I have a chat application on my website which I want to now add a way to insert code like this website stackoverflow has the code blocks for when you ask questions.
const codePattern = //jquery pattern here
function makeCodeBlock(str) {
return str.replace(codePattern, (s, match) => `<pre><code class="node.js">${match}</code></pre>`);
}
I wanna detect like when people type ` three times and the code block would be created from when the first three of that character are typed until they are typed another three times kind of like Discord's code blocks I just need to make my function be able to output the text inside of the three blacktick symbols and output what I have in my code above just removing the blackticks and using the code.