mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-22 20:26:50 +00:00
version 2 - beta
This commit is contained in:
12
src/utils/qortalLink/index.ts
Normal file
12
src/utils/qortalLink/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user