File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed
commonmark-lib/commonmark/private/parse
commonmark-test/tests/commonmark/parse Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 122
122
123
123
;; <https://spec.commonmark.org/0.30/#link-destination>
124
124
(define (try-peek-link-destination in [start-pos 0 ])
125
- (match (regexp-match-peek #px"<([^\r\n]*?)(?<!\\\\)> " in start-pos)
125
+ (match (regexp-match-peek #px"^ <([^\r\n]*?)(?<!\\\\)> " in start-pos)
126
126
; First, the simple case: a destination enclosed in <angle brackets>.
127
127
[(list peeked-bytes dest-bytes)
128
128
(list (+ start-pos (bytes-length peeked-bytes))
Original file line number Diff line number Diff line change
1
+ #lang racket/base
2
+
3
+ ;; Regression test for <https://github.com/lexi-lambda/racket-commonmark/issues/4>.
4
+
5
+ (require commonmark/struct
6
+ rackunit
7
+ "../test-util.rkt " )
8
+
9
+ (check-equal? (md "[a link](http://example.com).</span> " )
10
+ (document
11
+ (list
12
+ (paragraph
13
+ (list (link "a link " "http://example.com " #f ) ". " (html "</span> " ))))
14
+ '() ))
15
+
16
+ (check-equal? (md "[a link][1].</span> "
17
+ ""
18
+ "[1]: http://example.com " )
19
+ (document
20
+ (list
21
+ (paragraph
22
+ (list (link "a link " "http://example.com " #f ) ". " (html "</span> " ))))
23
+ '() ))
24
+
25
+ (check-equal? (md "This <span>is _emphasis_ and [a link](http://example.com).</span> " )
26
+ (document
27
+ (list
28
+ (paragraph
29
+ (list "This " (html "<span> " ) "is " (italic "emphasis " ) " and " (link "a link " "http://example.com " #f ) ". " (html "</span> " ))))
30
+ '() ))
31
+
32
+ (check-equal? (md "This <span>is _emphasis_ and [a link][1].</span> "
33
+ ""
34
+ "[1]: http://example.com " )
35
+ (document
36
+ (list
37
+ (paragraph
38
+ (list "This " (html "<span> " ) "is " (italic "emphasis " ) " and " (link "a link " "http://example.com " #f ) ". " (html "</span> " ))))
39
+ '() ))
40
+
41
+ (check-equal? (md "This <span>is _emphasis_ and [a link](http://example.com). " )
42
+ (document
43
+ (list
44
+ (paragraph
45
+ (list "This " (html "<span> " ) "is " (italic "emphasis " ) " and " (link "a link " "http://example.com " #f ) ". " )))
46
+ '() ))
47
+
48
+ (check-equal? (md "This <span>is _emphasis_ and [a link](http://example.com).</div> " )
49
+ (document
50
+ (list
51
+ (paragraph
52
+ (list "This " (html "<span> " ) "is " (italic "emphasis " ) " and " (link "a link " "http://example.com " #f ) ". " (html "</div> " ))))
53
+ '() ))
You can’t perform that action at this time.
0 commit comments