Thanks to chen bin, I have added a flyspell-generic-check-word-predicate
function to Markdown mode. If you're using the latest development version, or use the next release version, then you won't have to use local modifications to achieve this.
For those curious, perhaps to implement a predicate for another mode, the current function is below. It checks for code blocks, inline code, and comments using functions defined by Markdown mode. It also checks for certain faces to ignore: reference labels, Markdown markup, and URLs.
(defun markdown-flyspell-check-word-p ()
"Return t if `flyspell' should check word just before point.
Used for `flyspell-generic-check-word-predicate'."
(save-excursion
(goto-char (1- (point)))
(not (or (markdown-code-block-at-point-p)
(markdown-inline-code-at-point-p)
(markdown-in-comment-p)
(let ((faces (get-text-property (point) 'face)))
(if (listp faces)
(or (memq 'markdown-reference-face faces)
(memq 'markdown-markup-face faces)
(memq 'markdown-url-face faces))
(memq faces '(markdown-reference-face
markdown-markup-face
markdown-url-face))))))))
Note that the face
property may be a list, so this function handles that case as well.
markdown-pre-face
). The question is how to pass that info to Flyspell.