Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyspell not checking yml data #560

Closed
tranner opened this issue Nov 12, 2020 · 5 comments
Closed

Flyspell not checking yml data #560

tranner opened this issue Nov 12, 2020 · 5 comments

Comments

@tranner
Copy link

tranner commented Nov 12, 2020

Expected Behavior

The yml metadata at the top of the file contains important information including titles as well as code. Some of these should be spell checked by default. I would at least think it would be good to check for strings in quotes (i.e. "title") and spell check those.

Actual Behavior

The whole yml block is treated as code so nothing here picked up by flycheck leading to spelling mistakes in my title :(

Steps to Reproduce

  1. Download two files. test.el.txt and test.md.txt and remove .txt extension (needed for uploading?!):
    test.el.txt
    test.md.txt

  2. Run emacs -Q -l test.el test.md

  3. See asdasdasd in the main body highlighted as spelling error but not in the title.

Example output:

output

Backtrace

Software Versions

  • Markdown Mode: markdown-mode, version 2.4-dev
  • Emacs: GNU Emacs 27.1.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2020-08-21
  • OS: CentOS Linux release 7.8.2003 (Core)
@syohex
Copy link
Collaborator

syohex commented Nov 13, 2020

diff --git a/markdown-mode.el b/markdown-mode.el
index a1e37e0..a92a5c8 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -2150,7 +2150,8 @@ Depending on your font, some reasonable choices are:
 Used for `flyspell-generic-check-word-predicate'."
   (save-excursion
     (goto-char (1- (point)))
-    (if (or (markdown-code-block-at-point-p)
+    (if (or (and (markdown-code-block-at-point-p)
+                 (not (markdown-text-property-at-point 'markdown-yaml-metadata-section)))
             (markdown-inline-code-at-point-p)
             (markdown-in-comment-p)
             (markdown--face-p (point) '(markdown-reference-face

a

I suppose above patch fixes your issue. However I don't understand yet why original code ignores spell checking in YAML meta header.

@tranner
Copy link
Author

tranner commented Nov 13, 2020

Thanks - this seems to solve the problem at hand at least.

I end up with lots of spelling errors for the metadata keys too but I'd rather have too many errors highlighted rather than too few for now.

@syohex
Copy link
Collaborator

syohex commented Nov 14, 2020

I will apply above patch after merging #559 for avoiding code conflict.

@syohex
Copy link
Collaborator

syohex commented Nov 15, 2020

I have merged #561. Please check latest version.

@syohex syohex closed this as completed Nov 15, 2020
@tranner
Copy link
Author

tranner commented Nov 17, 2020

Thanks again - all fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants