Vscode-spell-checker: Change language in markdown code fences

Created on 15 Jul 2018  路  5Comments  路  Source: streetsidesoftware/vscode-spell-checker

Great extension! However I often make code fences in markdown, resulting in LOTS of false positive when vscode-spell-checker checks the code fence as if it was markdown code. Example:

````markdown

Some title

Bla bla this is markdown and all is good.

\usepackage[utf8]{inputenc}

``` which would result in warning onusepackageandinputenc`. Here is a screenshot that shows the issue:

image

The best solution would be to dynamically switch to the code fence language locally within the code fence.

The next-best solution would be to just ignore all content without code fences.

enhancement

Most helpful comment

It is possible to ignore those sections:

For all file types:

    "cSpell.ignoreRegExpList": [
         "/^```(?:.|\\s)+?^```/mig"
    ],

To have it apply only to markdown:

"cSpell.languageSettings": [
        {
            "languageId": "markdown",
            "ignoreRegExpList": [
                "/^```(?:.|\\s)+?^```/mig"
             ]
        }
    ]

All 5 comments

As a workaround, I have manually enabled the latex dictionary for the folder :)

It is possible to ignore those sections:

For all file types:

    "cSpell.ignoreRegExpList": [
         "/^```(?:.|\\s)+?^```/mig"
    ],

To have it apply only to markdown:

"cSpell.languageSettings": [
        {
            "languageId": "markdown",
            "ignoreRegExpList": [
                "/^```(?:.|\\s)+?^```/mig"
             ]
        }
    ]

Thanks, can confirm it works to ignore content in code fences 馃憤

  1. Any hope for locally applying dictionary in code fence according to code fence language?
  2. Any way of saying "Enable latex dict when editing markdown files"?

For inspiration, prettier.io actually implemented detection of language in code fences: https://prettier.io/blog/2018/04/11/1.12.0.html#support-fenced-codeblock-lang-followed-by-attributes-4153-https-githubcom-prettier-prettier-pull-4153-by-ikatyang-https-githubcom-ikatyang

Wanted behavior for markdown:

  • code block: follow the language declared
  • code block: if not language is declared (so it is plaintext), disable spellcheck by default or add an option to do it
  • inline code: disable spellcheck by default or add an option to do it

The current behavior is a nightmare for people writing technical stuff.

Else it generate too much false positive:

Plaintext code block:

image

image

Inline code:

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jose-a-sa picture jose-a-sa  路  6Comments

romines picture romines  路  3Comments

apptimise picture apptimise  路  6Comments

gbreeze picture gbreeze  路  7Comments

mgroves picture mgroves  路  5Comments