Function: markdown-match-italic

markdown-match-italic is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-match-italic LAST)

Documentation

Match inline italics from the point to LAST.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-match-italic (last)
  "Match inline italics from the point to LAST."
  (let* ((is-gfm (derived-mode-p 'gfm-mode))
         (regex (if is-gfm
                    markdown-regex-gfm-italic
                  markdown-regex-italic)))
    (let (done
          retval
          last-inline-code)
      (while (not done)
        (if (and (markdown-match-inline-generic regex last)
                   (not (markdown--face-p
                         (match-beginning 1)
                         '(markdown-html-attr-name-face markdown-html-attr-value-face))))
            (let ((begin (match-beginning 1))
                  (end (match-end 1))
                  (close-end (match-end 4)))
              (if (or (eql (char-before begin) (char-after begin))
                      (and last-inline-code
                           (>= begin (car last-inline-code))
                           (< begin (cdr last-inline-code)))
                      (save-match-data
                        (when (markdown-inline-code-at-pos begin (cdr last-inline-code))
                          (setq last-inline-code `(,(match-beginning 0) . ,(match-end 0)))))

                      (markdown-inline-code-at-pos-p (1- end))
                      (markdown-in-comment-p)
                      (markdown-range-property-any
                       begin begin 'face '(markdown-url-face
                                           markdown-plain-url-face
                                           markdown-markup-face))
                      (markdown-range-property-any
                       begin end 'face '(markdown-bold-face
                                         markdown-list-face
                                         markdown-hr-face
                                         markdown-math-face))
                      (and is-gfm
                           (or (char-equal (char-after begin) (char-after (1+ begin))) ;; check bold case
                               (not (markdown--gfm-markup-underscore-p begin close-end)))))
                  (progn (goto-char (min (1+ begin) last))
                         (unless (< (point) last)
                           (setq
                            done t)))
                (set-match-data (list (match-beginning 1) (match-end 1)
                                      (match-beginning 2) (match-end 2)
                                      (match-beginning 3) (match-end 3)
                                      (match-beginning 4) (match-end 4)))
                (setq done t
                      retval t)))
          (setq done t)))
      retval)))