Skip to content

Commit f28bafb

Browse files
committed
Update to CommonMark v0.31.2
1 parent f34feb8 commit f28bafb

File tree

6 files changed

+1582
-1582
lines changed

6 files changed

+1582
-1582
lines changed

commonmark-doc/scribblings/commonmark.scrbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
values))
4444
(apply hyperlink
4545
#:style style
46-
(~a "https://spec.commonmark.org/0.30/#"
46+
(~a "https://spec.commonmark.org/0.31.2/#"
4747
(~> (string-foldcase tag)
4848
maybe-singularize
4949
(string-replace #px"[^a-z]+" "-")))
@@ -70,7 +70,7 @@
7070

7171
@defmodule[commonmark]{
7272

73-
The @racketmodname[commonmark] library implements a @|CommonMark|-compliant Markdown parser. Currently, it passes all test cases in @hyperlink["https://spec.commonmark.org/0.30/"]{v0.30 of the specification}. By default, only the Markdown features specified by @CommonMark are supported, but non-standard support for @tech{footnotes} can be optionally enabled; see the @secref{extensions} section of this manual for more details.
73+
The @racketmodname[commonmark] library implements a @|CommonMark|-compliant Markdown parser. Currently, it passes all test cases in @hyperlink["https://spec.commonmark.org/0.31.2/"]{v0.31.2 of the specification}. By default, only the Markdown features specified by @CommonMark are supported, but non-standard support for @tech{footnotes} can be optionally enabled; see the @secref{extensions} section of this manual for more details.
7474

7575
The @racketmodname[commonmark] module reprovides all of the bindings provided by @racketmodname[commonmark/parse] and @racketmodname[commonmark/render/html] (but @emph{not} the bindings provided by @racketmodname[commonmark/struct]).}
7676

commonmark-lib/commonmark/private/parse/block.rkt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(:* "\\1[ \t]*" #:min 2)
2727
:eol))
2828

29-
;; <https://spec.commonmark.org/0.30/#list-marker>
29+
;; <https://spec.commonmark.org/0.31.2/#list-marker>
3030
(define-for-syntax (:list-marker #:interrupt? interrupt?)
3131
; If the list is ordered, it can only interrupt a paragraph if the
3232
; start number is 1.
@@ -330,7 +330,7 @@
330330
(set! partially-consumed-tab? #f)
331331
(list* full-match indent group-matches)]))))
332332

333-
;; <https://spec.commonmark.org/0.30/#block-quote-marker>
333+
;; <https://spec.commonmark.org/0.31.2/#block-quote-marker>
334334
(define (try-read-blockquote-marker)
335335
(try-with-optional-indent
336336
(λ (pos indent)
@@ -355,7 +355,7 @@
355355
#t]
356356
[_ #f]))))
357357

358-
;; <https://spec.commonmark.org/0.30/#list-marker>
358+
;; <https://spec.commonmark.org/0.31.2/#list-marker>
359359
(define (try-read-list-marker #:interrupt? interrupt?)
360360
(try-with-optional-indent
361361
(λ (pos indent)
@@ -545,7 +545,7 @@
545545
"h3" "h4" "h5" "h6" "head" "header" "hr" "html"
546546
"iframe" "legend" "li" "link" "main" "menu"
547547
"menuitem" "nav" "noframes" "ol" "optgroup"
548-
"option" "p" "param" "section" "source"
548+
"option" "p" "param" "search" "section"
549549
"summary" "table" "tbody" "td" "tfoot" "th"
550550
"thead" "title" "tr" "track" "ul"))
551551
(:or "[ \t>]" :eol "/>"))))))
@@ -998,7 +998,7 @@ of the list item. |#
998998
;; Link reference definitions
999999

10001000
;; § 4.7 Link reference definitions
1001-
;; <https://spec.commonmark.org/0.30/#link-reference-definition>
1001+
;; <https://spec.commonmark.org/0.31.2/#link-reference-definition>
10021002
(define (try-read-link-reference-definition in)
10031003
(define (try-peek-eol start-pos)
10041004
(match (regexp-match-peek-positions (px "^" "[ \t\r\n]*" :eol) in start-pos)

commonmark-lib/commonmark/private/parse/common.rkt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
;; § 2.1 Characters and lines
3434

3535
(begin-for-syntax
36-
; <https://spec.commonmark.org/0.30/#line-ending>
36+
; <https://spec.commonmark.org/0.31.2/#line-ending>
3737
(define :newline (:: "\n|\r\n?"))
38-
; <https://spec.commonmark.org/0.30/#ascii-punctuation-character>
38+
; <https://spec.commonmark.org/0.31.2/#ascii-punctuation-character>
3939
(define :ascii-punctuation "[!-/:-@[-`{-~]")
40-
; <https://spec.commonmark.org/0.30/#ascii-control-character>
40+
; <https://spec.commonmark.org/0.31.2/#ascii-control-character>
4141
(define :ascii-control: "\0-\x1F\x7F")
4242

4343
; Often referred to in the spec using the phrase “spaces, tabs, and up to one
@@ -47,12 +47,12 @@
4747
(define :space* (:* "[" :space: "]"))
4848
(define :space+ (:+ "[" :space: "]"))
4949

50-
; <https://spec.commonmark.org/0.30/#link-destination>
50+
; <https://spec.commonmark.org/0.31.2/#link-destination>
5151
(define :link-destination
5252
(:or "<([^\r\n]*?)(?<!\\\\)>"
5353
(:group "[^< " :ascii-control: "]")))
5454

55-
;; § 6.5 Raw HTML <https://spec.commonmark.org/0.30/#raw-html>
55+
;; § 6.5 Raw HTML <https://spec.commonmark.org/0.31.2/#raw-html>
5656
(define (:html-open-close #:allow-newlines? allow-newlines?)
5757
(define-values [:sp: :sp* :sp+ :nl:]
5858
(if allow-newlines?
@@ -86,8 +86,8 @@
8686
(char<=? #\{ c #\~)))
8787

8888
(define (unicode-punctuation? c)
89-
(or (ascii-punctuation? c)
90-
(memq (char-general-category c) '(pc pd pe pf pi po ps))))
89+
(or (char-punctuation? c)
90+
(char-symbolic? c)))
9191

9292
;; -----------------------------------------------------------------------------
9393

@@ -106,21 +106,21 @@
106106
"\\]")
107107
in start-pos)
108108
[(list peeked-bytes (app bytes->string/utf-8 label-str))
109-
; From <https://spec.commonmark.org/0.30/#link-label>:
109+
; From <https://spec.commonmark.org/0.31.2/#link-label>:
110110
; “Between these brackets there must be at least one character that is
111111
; not a space, tab, or line ending.”
112112
#:when (regexp-match? (px "[^" :space: "]") label-str)
113113
(list (+ start-pos (bytes-length peeked-bytes))
114114
(normalize-link-label label-str))]
115115
[_ #f]))
116116

117-
;; <https://spec.commonmark.org/0.30/#matches>
117+
;; <https://spec.commonmark.org/0.31.2/#matches>
118118
(define (normalize-link-label str)
119119
(~> (string-foldcase str)
120120
(string-trim (px :space+))
121121
(string-replace (px :space+) " ")))
122122

123-
;; <https://spec.commonmark.org/0.30/#link-destination>
123+
;; <https://spec.commonmark.org/0.31.2/#link-destination>
124124
(define (try-peek-link-destination in [start-pos 0])
125125
(match (regexp-match-peek #px"^<([^\r\n]*?)(?<!\\\\)>" in start-pos)
126126
; First, the simple case: a destination enclosed in <angle brackets>.

commonmark-lib/commonmark/private/parse/inline.rkt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
;; § 6.5 Raw HTML
3030
(define :html-tag
3131
(let ()
32-
(define :comment (:: "<!--" "(?!>|->)" (:* (:or "[^-]" "-[^-]")) "-->"))
33-
(define :instruction (:: "<\\?" (:* (:or "[^?]" "\\?[^>]")) "\\?>"))
32+
(define :comment (:: "<!--" (:or ">" "->" (:: (:*? ".") "-->"))))
33+
(define :instruction (:: "<\\?" (:*? ".") "\\?>"))
3434
(define :declaration (:: "<!" "[a-zA-Z]" "[^>]*" ">"))
35-
(define :cdata-section (:: "<!\\[CDATA\\[" (:* (:or "[^]]" "\\][^]]" "\\]\\][^>]")) "\\]\\]>"))
35+
(define :cdata-section (:: "<!\\[CDATA\\[" (:*? ".") "\\]\\]>"))
3636

3737
(:or (:html-open-close #:allow-newlines? #t) :comment :instruction :declaration :cdata-section))))
3838

@@ -312,15 +312,15 @@ positions in characters rather than bytes, which explains why we need to call
312312

313313
(define (try-read-link-target content-label-str)
314314
(or
315-
;; Full reference links <https://spec.commonmark.org/0.30/#reference-link>
315+
;; Full reference links <https://spec.commonmark.org/0.31.2/#reference-link>
316316
(match-and*
317317
[(try-peek-link-label in) => (list label-pos label-str)]
318318
[(hash-ref link-reference-defns label-str #f)
319319
=> link-ref
320320
(read-bytes label-pos in)
321321
link-ref])
322322

323-
;; Inline links <https://spec.commonmark.org/0.30/#inline-link>
323+
;; Inline links <https://spec.commonmark.org/0.31.2/#inline-link>
324324
(let ()
325325
(define (try-peek-end start-pos)
326326
(match-and*
@@ -370,8 +370,8 @@ positions in characters rather than bytes, which explains why we need to call
370370
(let ()
371371
(define normalized-label (normalize-link-label content-label-str))
372372
(or
373-
;; Collapsed reference links <https://spec.commonmark.org/0.30/#collapsed-reference-link>,
374-
;; and shortcut reference links <https://spec.commonmark.org/0.30/#shortcut-reference-link>
373+
;; Collapsed reference links <https://spec.commonmark.org/0.31.2/#collapsed-reference-link>,
374+
;; and shortcut reference links <https://spec.commonmark.org/0.31.2/#shortcut-reference-link>
375375
(match-and*
376376
[(hash-ref link-reference-defns normalized-label #f) => link-ref]
377377
[(or (regexp-try-match #px"^\\[\\]" in)

0 commit comments

Comments
 (0)