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'."
(goto-char (1- (point)))
(not (or (markdown-code-block-at-point-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
Note that the
face property may be a list, so this function handles that case as well.