practicalli / practicalli/nvim-astro

treesitter: disable highlight for indented code block in markdown

Open
#51 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
Lua
Stars
13
Forks
11
PR merge metrics
No merged PRs in 30d

Description

When indenting text by 4 spaces (or more) in a markdown file, the text is changed to a different color.

This indented color masks any other color that my have been previously applied.

When a fenced code-block is indented, the syntax highlighting of its language is overridden by that of the single indented code color.

Is there a way to disable highlighting when text is indented by 4 or more blank characters?

Investigating

:help treesitter

indented_code_blocks seems to be the treesitter name for the lines of text indented by 4 spaces.

Two possible approaches

  • after/queries/markdown/highlights.scm
  • Through vim.treesitter.query.set().

Treesitter markdown queries

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with :help treesitter and inspect after/queries/markdown/highlights.scm, especially the indented_code_blocks query referenced in the issue. Compare that with the vim.treesitter.query.set() approach. Done means indented Markdown text no longer receives the single indented-code highlight, while indented fenced code blocks retain their language highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.