Function: markdown-syntax-propertize-comments

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

Signature

(markdown-syntax-propertize-comments START END)

Documentation

Match HTML comments from the START to END.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-syntax-propertize-comments (start end)
  "Match HTML comments from the START to END."
  ;; Implement by loop instead of recursive call for avoiding
  ;; exceed max-lisp-eval-depth issue
  ;; https://github.com/jrblevin/markdown-mode/issues/536
  (let (finish)
    (goto-char start)
    (while (not finish)
      (let* ((in-comment (nth 4 (syntax-ppss)))
             (comment-begin (nth 8 (syntax-ppss))))
        (cond
         ;; Comment start
         ((and (not in-comment)
               (re-search-forward markdown-regex-comment-start end t)
               (not (markdown-inline-code-at-point-p))
               (not (markdown-code-block-at-point-p)))
          (let ((open-beg (match-beginning 0)))
            (put-text-property open-beg (1+ open-beg)
                               'syntax-table (string-to-syntax "<"))
            (goto-char (min (1+ (match-end 0)) end (point-max)))))
         ;; Comment end
         ((and in-comment comment-begin
               (re-search-forward markdown-regex-comment-end end t))
          (let ((comment-end (match-end 0)))
            (put-text-property (1- comment-end) comment-end
                               'syntax-table (string-to-syntax ">"))
            ;; Remove any other text properties inside the comment
            (remove-text-properties comment-begin comment-end
                                    markdown--syntax-properties)
            (put-text-property comment-begin comment-end
                               'markdown-comment (list comment-begin comment-end))
            (goto-char (min comment-end end (point-max)))))
         ;; Nothing found
         (t (setq finish t)))))
    nil))