mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-04-28 13:57:52 +00:00
12 lines
452 B
TypeScript
12 lines
452 B
TypeScript
export function convertQortalLinks(inputHtml: string) {
|
|
// Regular expression to match 'qortal://...' URLs.
|
|
// This will stop at the first whitespace, comma, or HTML tag
|
|
var regex = /(qortal:\/\/[^\s,<]+)/g;
|
|
|
|
// Replace matches in inputHtml with formatted anchor tag
|
|
var outputHtml = inputHtml.replace(regex, function (match) {
|
|
return `<a href="${match}" class="qortal-link">${match}</a>`;
|
|
});
|
|
|
|
return outputHtml;
|
|
} |