Skip to content

[FEATURE]: recognize code snippets in Markdown to apply the correct language spellchecking to snippets #198

@jerabaul29

Description

@jerabaul29

Feature Description

In markdown, one regularly ends up with snippets, like:

# an example snippet
mkdir some_dir

At present, it looks like codebook flashes mkdir in the snippet as a typo; for example:

Image

but mkdir is not flashed as a typo when using codebook directly on a .sh file:

Image

Use Case

Is there a way to make codebook aware of code snippets in markdown (and possibly down the line in other languages if relevant), and apply, if available, the relevant spellcheck rules?

Proposed Solution

No idea if / how easy this would be - is there a way in tree-sitter to easily spot code snippets within markdown, and then to use inside this snippet codebook with another language config?

Alternative Solutions

For now I just get spellcheck errors that are not correct - a tiny bit annoying, but I can live with it :) .

Examples

Have a markdown file:

"
This is a file with a snippet:

# some bash; mkdir in a .sh file is fine by codebook, but will be spotted when inside a snippet in a markdown file
mkdir some_dir

"

the mkdir gets flashed as a typo:

Image

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions