File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const subGroup = '[A-Za-z][\\w_]+'
8
8
9
9
const mentionRegex = new RegExp ( '\\B@(' + userGroup + '(?:\\/' + userGroup + ')?)' , 'gi' )
10
10
const subRegex = new RegExp ( '~(' + subGroup + '(?:\\/' + subGroup + ')?)' , 'gi' )
11
- const nostrIdRegex = / \b ( ( n p u b 1 | n e v e n t 1 | n p r o f i l e 1 | n o t e 1 | n a d d r 1 ) [ 0 2 - 9 a c - h j - n p - z ] + ) \b / g
11
+ const nostrIdRegex = / \b ( ( n p u b 1 | n e v e n t 1 | n p r o f i l e 1 | n o t e 1 | n a d d r 1 ) [ 0 2 - 9 a c - h j - n p - z ] + ) \b / i
12
12
13
13
export default function rehypeSN ( options = { } ) {
14
14
const { stylers = [ ] } = options
@@ -78,7 +78,7 @@ export default function rehypeSN (options = {}) {
78
78
! parent . children . some ( s => s . type === 'text' && s . value . trim ( ) ) &&
79
79
toString ( node ) === node . properties . href ) {
80
80
const embed = parseEmbedUrl ( node . properties . href )
81
- if ( embed ) {
81
+ if ( embed && ! nostrIdRegex . test ( node . properties . href ) ) {
82
82
node . tagName = 'embed'
83
83
node . properties = { ...embed , src : node . properties . href }
84
84
} else {
@@ -137,7 +137,7 @@ export default function rehypeSN (options = {}) {
137
137
}
138
138
139
139
// Handle Nostr IDs
140
- if ( node . type === 'text' ) {
140
+ if ( node . type === 'text' && ! ( parent && [ 'a' , 'autolink' ] . includes ( parent . tagName ) ) ) {
141
141
const newChildren = [ ]
142
142
let lastIndex = 0
143
143
let match
You can’t perform that action at this time.
0 commit comments