Function: markdown-syntax-propertize-extend-region

markdown-syntax-propertize-extend-region is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-syntax-propertize-extend-region START END)

Documentation

Extend START to END region to include an entire block of text.

This helps improve syntax analysis for block constructs. Returns a cons (NEW-START . NEW-END) or nil if no adjustment should be made. Function is called repeatedly until it returns nil. For details, see syntax-propertize-extend-region-functions.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-syntax-propertize-extend-region (start end)
  "Extend START to END region to include an entire block of text.
This helps improve syntax analysis for block constructs.
Returns a cons (NEW-START . NEW-END) or nil if no adjustment should be made.
Function is called repeatedly until it returns nil. For details, see
`syntax-propertize-extend-region-functions'."
  (save-match-data
    (save-excursion
      (let* ((new-start (progn (goto-char start)
                               (skip-chars-forward "\n")
                               (if (re-search-backward "\n\n" nil t)
                                   (min start (match-end 0))
                                 (point-min))))
             (new-end (progn (goto-char end)
                             (skip-chars-backward "\n")
                             (if (re-search-forward "\n\n" nil t)
                                 (max end (match-beginning 0))
                               (point-max))))
             (code-match (markdown-code-block-at-pos new-start))
             ;; FIXME: The `code-match' can return bogus values
             ;; when text has been inserted/deleted!
             (new-start (min (or (and code-match (cl-first code-match))
                                 (point-max))
                             new-start))
             (code-match (and (< end (point-max))
                              (markdown-code-block-at-pos end)))
             (new-end (max (or (and code-match (cl-second code-match)) 0)
                           new-end)))

        (unless (and (eq new-start start) (eq new-end end))
          (cons new-start (min new-end (point-max))))))))