Using find & replace to add bbcode

The OpenAI api returns text for code wrapped in backticks.

Like this…

const button1 = document.getElementById('button1');
const button3 = document.getElementById('button3');

button3.addEventListener('click', () => { = 'none';

Is there a way to use find and replace, or anything else to replace these ticks with bbcode so that the code sections are differentiated in the returned text?

I am trying to achieve a similar effect to what ChatGPT does by differentiating the code sections this way…

This topic was automatically closed after 70 days. New replies are no longer allowed.