Skip to content

Commit 9116d50

Browse files
committed
Plugins: auto-anchor: use smallest match
1 parent 87d715f commit 9116d50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

_plugins/auto-anchor.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
if post.data["auto_id"] != false
1313
post.content.gsub!(/^ *- .*/) do |string|
1414
## List items surrounded in bold
15-
title = string.match(/\*\*.*\*\*/).to_s
15+
title = string.match(/\*\*.*?\*\*/).to_s
1616
## List items surrounded in italics
17-
title.empty? && title = string.match(/\*.*\*/).to_s
17+
title.empty? && title = string.match(/\*.*?\*/).to_s
1818
## List items that are hyperlinks
19-
title.empty? && title = string.match(/\[.*\][(\[]/).to_s
19+
title.empty? && title = string.match(/\[.*?\][(\[]/).to_s
2020

2121
if title.empty?
2222
## No match, pass item through unchanged

0 commit comments

Comments
 (0)