content: parse lightning addresses and render as links
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details

LN addresses use too much screen real estate, render as link seems
more useful.

lightning links are words starting with the following prefix:
lnbc for Bitcoin mainnet, lntb for testnet, lntbs for signet, and
lnbcrt for regtest

https://github.com/lightning/bolts/blob/master/11-payment-encoding.md#human-readable-part
pull/52/head
OFF0 2 years ago
parent d7f75f92e0
commit 387f4de3f2
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -59,6 +59,11 @@ export function parseTextContent(string) {
.map(line => {
const words = line.split(' ');
return words.map(word => {
if (word.match(/^ln(tbs?|bcr?t?)[a-z0-9]+$/g)) {
return elem('a', {
href: `lightning:${word}`
}, `lightning:${word.slice(0, 24)}`);
}
if (!word.match(/(https?:\/\/|www\.)\S*/)) {
return word;
}

Loading…
Cancel
Save