Commit graph

60 commits

Author SHA1 Message Date
Riley Bruins
1adcd57119 feat(markdown): fold sublists 2025-03-03 09:44:46 +01:00
Christian Clason
93ce9feb4f feat(markdown): completely conceal codeblock fences on nightly
Required to make https://github.com/neovim/neovim/pull/31324 work with
nvim-treesitter.
2025-02-25 14:07:31 +01:00
Omar Valdez
51bba660a8 refactor(queries): Remove quotes from properties in set! directive 2024-07-28 11:43:41 +02:00
Riley Bruins
bb0eb73014 fix(markdown): capture entire heading line 2024-06-14 08:35:26 +02:00
Riley Bruins
7f31793159
feat(markdown): yaml, toml metadata highlights (#6360) 2024-03-26 17:19:51 +02:00
Riley Bruins
a0f18ee98c feat(markdown): highlight link label delimiter 2024-03-07 12:50:12 +02:00
Christian Clason
99ddf57353
feat(highlights)!: enforce documented captures (#6232)
Problem: Allowing undocumented "secret" (sub)captures makes it harder
to write comprehensive colorschemes and catch inconsistent captures.

Solution: Only allow captures listed in CONTRIBUTING.md. Add useful
(cross-language) subcaptures and drop language-specific or too niche
ones.

Follow-up: Adding further `*.builtin` captures and changing queries to
use them.

Language-specific subcaptures should instead be added in user config or
a custom language plugin.
2024-03-03 11:00:11 +01:00
dundargoc
9bc21966f2 fix: typos 2024-02-19 17:45:54 +01:00
Christian Clason
a8fa3047b5 fix(highlights): use markup.raw.delimiter for fences 2024-01-20 13:04:29 +01:00
Riley Bruins
f5a839d1e8 fix(markdown): remove @none from code fences 2024-01-20 10:24:57 +01:00
Pham Huy Hoang
57a8acf0c4 chore: query formatting 2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455 feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
Riley Bruins
e9acd01a4a
fix(markdown): revert bullet conceals due to spacing issues (#5742) 2023-11-30 09:36:07 +09:00
Riley Bruins
f2de95e30a
feat(markdown): conceals for bullets, block quotes
* feat(markdown): conceals for bullets, block quotes

* fix: remove conceals for block quotes, change list minus to em dash

* fix(markdown): allow empty bullets to be concealed
2023-11-19 10:20:51 +09:00
Riley Bruins
28e1361d4a fix(markdown): set block quote priority within allowed range 2023-10-15 14:34:08 -04:00
Riley Bruins
ea5f5fddad fix(markdown): give code blocks higher priority than block quotes 2023-10-15 14:34:08 -04:00
Maria José Solano
eb0f975bf2 feat(markdown): conceal triple backticks and HTML entities 2023-09-17 23:16:53 +02:00
Pham Huy Hoang
78b54eb7f6 chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter

- update health check
- update doc
2023-08-12 17:34:15 +02:00
Amaan Qureshi
c9d5812ba3 fix(markdown): elm injection no longer segfaults 2023-06-21 19:13:51 +02:00
Christian Clason
a034c7aa25
fix(highlights): lower priority for codeblocks with injections (#4905) 2023-06-05 14:09:44 +02:00
Pham Huy Hoang
5781c94703
feat: markdown indents (#4862) 2023-05-26 08:08:06 +00:00
Christian Clason
680807fa6a highlights(markup): distinguish heading level in queries
also add a few queries from Helix and remove controversial
code block conceal in Markdown
2023-05-13 16:50:32 +02:00
Pham Huy Hoang
4fe6b4c07f fix: add @combined to markdown html 2023-05-03 16:23:09 -04:00
Benny Powers
cdc45ac6ba
feat(markdown): configured aliases for fenced code block languages (#4659)
* feat(markdown): configured aliases for languages

* refactor: use vim.treesitter.match

* refactor: rename local vars

* fix: query syntax
2023-04-18 21:51:14 +09:00
Christian Clason
7e4a7c4508 markdown: add strikethrough and blockquote captures 2023-01-14 11:52:25 +01:00
Folke Lemaitre
39bda37d4a feat: added highlights for markdown checkboxes 2022-12-02 18:02:16 +01:00
Folke Lemaitre
a2ff4b42e1 feat: conceal backslash escape 2022-10-30 11:38:42 +01:00
Folke Lemaitre
9ada5f70f9 feat: markdown table highlights and inline 2022-10-29 15:31:35 +02:00
Lewis Russell
2eaf188269 fix(fold): don't include whitespace end regions
Some languages that are difficult to parse via Treesitter may
incorrectly include whitespace lines at the end of regions. This can
makes the calculated folds sub-optimal.

To recitfy, use a custom directive (trim), to calculate the range with
the trailing whitespace lines removed. Note this only works if the
region end column is 0.

Also added folds for Make.
2022-09-12 11:49:51 +01:00
Lewis Russell
2a63ea5665 feat(spell): upstream spell queries from spellsitter 2022-09-06 12:44:19 +01:00
Zheng Piaodan
6b0ddaa9b3 feat: allow to fold markdown sections 2022-08-26 05:54:10 -07:00
Andy Freeland
0d0949683d Support TOML metadata in Markdown injections
Hugo, Zola, and likely other static site generators use `+++` for TOML,
not YAML.
2022-07-25 21:28:40 +02:00
kiyan
3bd228781b fix: disable elm parser in markdown to avoid segfault
the Elm parser segfaults when injected in markdown. Disable it for now.
See https://github.com/elm-tooling/tree-sitter-elm/issues/124
2022-07-15 12:08:58 +02:00
MDeiml
f75e27c217 Use markdown metadata blocks for injection 2022-07-03 11:25:50 +02:00
Matthias Deiml
002084b1be
feat(markdown)!: switch to split parser (#3048)
* switch to split markdown parser with separate block and inline parsers to improve performance
* add exclude_children! directive (useful for something like Injected markdown incorrectly highlights indented docstrings #2212)
* split markdown queries into block and inline ones and add the injection for inline into block grammar
* add include_dir option to parser configs (needed because the two grammars don't live in the repos root directory)

BREAKING CHANGE: downstream queries need to be adapted to new parser
2022-06-26 18:02:29 +02:00
Jonathan Lopez
238532fe82 Simplify inline conceal 2022-06-22 13:56:11 +02:00
Jonathan Lopez
536f4294f6 Refactor markdown conceal code 2022-06-22 13:56:11 +02:00
Jonathan Lopez
778bfc337a Conceal markdown links 2022-06-22 13:56:11 +02:00
Stephan Seitz
436d2ebe24 highlights(markdown): fix conceal capture 2022-04-15 18:47:53 +02:00
Stephan Seitz
f0398b7329 highlights(markdown): conceal link markers 2022-04-15 18:42:53 +02:00
Stephan Seitz
2bedaeb732 highlights(markdown): conceal emphasis_delimiter 2022-04-15 18:42:53 +02:00
Stephan Seitz
ade64b4459 highlights(markdown): add conceal to fenced code blocks 2022-04-15 18:42:53 +02:00
Gustaf Lindstedt
01150f50e7 Highlight markdown uri_autolink as @text.uri 2022-03-14 21:34:15 +01:00
MDeiml
7e3b06df71 Only allow yaml at start of file 2022-02-09 21:25:31 +01:00
MDeiml
9fff379c17 Add highlight for markdown delimiters 2022-01-11 12:05:56 +01:00
MDeiml
b5cdb868c7 Fix slow startup times for markdown grammar 2022-01-10 20:32:27 +01:00
MDeiml
391f29c03a Add highlight for quote marker 2022-01-08 20:00:28 +01:00
numToStr
ab691444ce highlights(markdown): image_description as reference 2022-01-07 11:14:29 +01:00
numToStr
2a49c05f66 highlights(markdown): image ! as delimeter 2022-01-07 11:14:29 +01:00
numToStr
5b69f82e15 highlights(markdown): link_title as string literal 2022-01-07 11:14:29 +01:00