function wrapLinks() {
  var elements = document.querySelectorAll("p")

  // Loop through each element
  elements.forEach(element => {
    // Get the text content of the element
    var text = element.innerHTML

    // Regex to find text that is a link
    var regex = /((http|https):[^\s]+)/g

    if (!text.includes("href=")){
      element.innerHTML = text.replace(regex, '<a href="$1">$1</a>')
    }
  })
}

$(function () {
  wrapLinks()
});