/** * 自動產生連結。 * * @param {string} text 要處理的字串。 * @return {string} 處理好的字串。 */ function autohref(text) { httpPattern = /(http|https):\/\/.+/ toOutput = '' for (t of text.split(' ')) { if (t.match(httpPattern)) { toOutput += `${t}` + ' ' } else { toOutput += t + ' ' } } return toOutput }