Function: markdown-ts--image-alone-on-line-p
markdown-ts--image-alone-on-line-p is a byte-compiled function defined
in markdown-ts-mode.el.gz.
Signature
(markdown-ts--image-alone-on-line-p NODE)
Documentation
Return non-nil if image NODE is the only content on its line.
Whitespace, block quote markers (>), and list markers
(-, *, +, 1.) before the image are ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
;;; Image handling:
(defun markdown-ts--image-alone-on-line-p (node)
"Return non-nil if image NODE is the only content on its line.
Whitespace, block quote markers (`>'), and list markers
\(`-', `*', `+', `1.') before the image are ignored."
(let ((node-start (treesit-node-start node))
(node-end (treesit-node-end node)))
(save-excursion
(goto-char node-start)
(let ((bol (line-beginning-position))
(eol (line-end-position)))
;; Before the image: only block quote markers, whitespace,
;; and an optional list marker are allowed.
(and (string-match-p
(rx bos
(zero-or-more (any "> \t"))
(optional (or (seq (any "-*+") " ")
(seq (one-or-more digit) (any ".)" ) " ")))
eos)
(buffer-substring-no-properties bol node-start))
;; After the image: only trailing whitespace allowed.
(string-match-p
(rx bos (zero-or-more (any " \t")) eos)
(buffer-substring-no-properties node-end eol)))))))