JSFiddle - React, Tailwind, and code Playground

by Mottie

HTML

<ul>
    <li class='custom'>
        <legend>images:</legend>
        {[img.png][1desc][2desc]} {[img2.png][1desc2][2desc2]}
    </li>
</ul>

JavaScript

function textToImg(theImg) {
  return theImg.replace(
           /\{\s*\[\s*(.*?)\s*\]\s*\[\s*(.*?)\s*\]\s*\[\s*(.*?)\s*\]\s*\}/gi,
           '<img src="$1" title="$2 - $3"/>'
         );
}

jQuery('li.custom').each(function() {
    current = jQuery(this);
    IMG = textToImg(current.html());
    current.html(IMG);
});