@@ -1574,6 +1574,13 @@ MIDDLE-BEGIN is the start of the \"middle\" section of the block."
1574
1574
(put-text-property close-begin close-end
1575
1575
(cl-cadadr fence-spec) close-data))))
1576
1576
1577
+ (defun markdown--triple-quote-single-line-p (begin)
1578
+ (save-excursion
1579
+ (goto-char begin)
1580
+ (save-match-data
1581
+ (and (search-forward "```" nil t)
1582
+ (search-forward "```" (line-end-position) t)))))
1583
+
1577
1584
(defun markdown-syntax-propertize-fenced-block-constructs (start end)
1578
1585
"Propertize according to `markdown-fenced-block-pairs' from START to END.
1579
1586
If unable to propertize an entire block (if the start of a block is within START
@@ -1608,7 +1615,8 @@ start which was previously propertized."
1608
1615
(while (re-search-forward start-reg end t)
1609
1616
;; we assume the opening constructs take up (only) an entire line,
1610
1617
;; so we re-check the current line
1611
- (let* ((cur-line (buffer-substring (point-at-bol) (point-at-eol)))
1618
+ (let* ((block-start (match-beginning 0))
1619
+ (cur-line (buffer-substring (point-at-bol) (point-at-eol)))
1612
1620
;; find entry in `markdown-fenced-block-pairs' corresponding
1613
1621
;; to regex which was matched
1614
1622
(correct-entry
@@ -1625,18 +1633,20 @@ start which was previously propertized."
1625
1633
(cl-caadr correct-entry)
1626
1634
(if (and (match-beginning 1) (match-end 1))
1627
1635
(- (match-end 1) (match-beginning 1))
1628
- 0))))
1629
- ;; get correct match data
1630
- (save-excursion
1631
- (beginning-of-line)
1632
- (re-search-forward
1633
- (markdown-maybe-funcall-regexp (caar correct-entry))
1634
- (point-at-eol)))
1635
- ;; mark starting, even if ending is outside of region
1636
- (put-text-property (match-beginning 0) (match-end 0)
1637
- (cl-cadar correct-entry) (match-data t))
1638
- (markdown-propertize-end-match
1639
- end-reg end correct-entry enclosed-text-start))))))
1636
+ 0)))
1637
+ (prop (cl-cadar correct-entry)))
1638
+ (when (or (not (eq prop 'markdown-gfm-block-begin))
1639
+ (not (markdown--triple-quote-single-line-p block-start)))
1640
+ ;; get correct match data
1641
+ (save-excursion
1642
+ (beginning-of-line)
1643
+ (re-search-forward
1644
+ (markdown-maybe-funcall-regexp (caar correct-entry))
1645
+ (point-at-eol)))
1646
+ ;; mark starting, even if ending is outside of region
1647
+ (put-text-property (match-beginning 0) (match-end 0) prop (match-data t))
1648
+ (markdown-propertize-end-match
1649
+ end-reg end correct-entry enclosed-text-start)))))))
1640
1650
1641
1651
(defun markdown-syntax-propertize-blockquotes (start end)
1642
1652
"Match blockquotes from START to END."
0 commit comments