Skip to content

Commit a927169

Browse files
committed
lesson_check.py: relax P_LINK_IMAGE_LINE pattern
This PR allows up to 3 non-word (`\W` in Python's `re`-speak) characters in the beginning and end of the pattern that matches links and images. This is to allow lesson developers place punctuation marks, parentheses, or other symbols before or after the link or image on the same line in Markdown.
1 parent af7efa5 commit a927169

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

bin/lesson_check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@
5959
# Pattern to match image-only and link-only lines
6060
P_LINK_IMAGE_LINE = re.compile(r'''
6161
[> #]* # any number of '>', '#', and spaces
62+
\W{,3} # up to 3 non-word characters
6263
!? # ! or nothing
6364
\[[^]]+\] # [any text]
6465
[([] # ( or [
6566
[^])]+ # 1+ characters that are neither ] nor )
6667
[])] # ] or )
6768
(?:{:[^}]+})? # {:any text} or nothing
69+
\W{,3} # up to 3 non-word characters
6870
[ ]* # any number of spaces
6971
\\?$ # \ or nothing + end of line''', re.VERBOSE)
7072

0 commit comments

Comments
 (0)