MacDownApp / macdown

Open source Markdown editor for macOS.
https://macdown.uranusjr.com/
9.43k stars 1.09k forks source link

Ignore spell-checking in code blocks #121

Open itmm opened 10 years ago

itmm commented 10 years ago

Is it possible to adjust the spell checking, so it won't mark everything in code fragments that are put in the markdown with single back ticks (v_args) or as blocks like the following one?

```c
int foo = EXIT_SUCCESS;
uranusjr commented 10 years ago

Good idea. Would then need to add an option to turn it off.

Not sure how this can be done yet, but if it’s possible this would be pretty nice. Wonder why I never thought of that before!

uranusjr commented 10 years ago

This will require upstream (Hoedown) support so that we can map source file locations (a range of text to syntax-check) with rendering results (whether a block/span is code). Will work on the backend first before coming back for this.

benjaminmiller commented 8 years ago

I don't think link URLs need spell checking—it's distracting if the doc has lots of links.

What does the upstream label mean?

uranusjr commented 8 years ago

It means this is a problem inherited from an library MacDown depends on (upstream component in tech jargon).

In this particular case, the spell checker needs to be aware of a location of the code block (or URL etc.) in the file to be able to exclude it from being spell-checked. This requires the parser to support this feature, and the one we use now currently doesn’t.

JanX2 commented 8 years ago

A workaround could be to run the text through data detectors and exclude the URLs this way. Relative links wouldn’t work, of course.

Punthooft commented 5 years ago

Is this issue still alive? We write a lot of docs using MacDown. The spellchecker in code blocks is real annoying.

A possibility could be to get the document, remove all code / url / frag etc from the text. And hand that text over to the spell checker!?