feat: upgrade tree-sitter from 0.24 to 0.25#207
Closed
mikkihugo wants to merge 2 commits intotree-sitter-grammars:split_parserfrom
Closed
feat: upgrade tree-sitter from 0.24 to 0.25#207mikkihugo wants to merge 2 commits intotree-sitter-grammars:split_parserfrom
mikkihugo wants to merge 2 commits intotree-sitter-grammars:split_parserfrom
Conversation
This commit updates the tree-sitter dependency from 0.24 to 0.25, addressing API changes introduced in the newer version. ## Changes - **Cargo.toml**: Update tree-sitter dependency from `0.24` to `0.25` - **bindings/rust/parser.rs**: - Replace deprecated `parse_with()` with `parse_with_options()` - Update API calls to match tree-sitter 0.25 signature - `parse_with_options` now takes 3 args: callback, old_tree, options - Fix lifetime elision warning in `walk()` method ## Testing All existing tests pass with tree-sitter 0.25: - `can_load_block_grammar` - `can_load_inline_grammar` - `markdown_cursor` - `table` - `inline_ranges` ## Breaking Changes None for users of this library. The public API remains unchanged. Internal implementation updated to use newer tree-sitter APIs. ## Benefits - Compatible with latest tree-sitter ecosystem - No more version conflicts for projects using tree-sitter 0.25 - Future-proof for upcoming tree-sitter features
1 task
Fixes tree-sitter-grammars#174 ## Problem The `link_destination` node was incorrectly including the angle brackets `<` and `>` when parsing links like `[text](<https://example.com>)`. According to the CommonMark spec, angle brackets are delimiters and should not be part of the link destination itself. ## Solution Modified the grammar in `common/common.js` to wrap the content inside angle brackets with an `alias()`, excluding the brackets from the `link_destination` node range. **Before:** ``` link_destination [0, 10] - [0, 31] # Includes < and > ``` **After:** ``` link_destination [0, 11] - [0, 30] # Excludes < and > ``` ## Changes - `common/common.js`: Wrapped repeated content in `alias()` for angle bracket case - Regenerated parsers with `tree-sitter generate` ## Testing ✅ All existing tests pass ✅ Parser correctly excludes angle brackets from link destination range Co-authored-by: Claude <noreply@anthropic.com>
Author
|
I've also added a fix for #174 to this PR! Additional Fix: Exclude Angle Brackets from link_destinationThe Fix: Modified grammar to exclude Before: All tests still pass! This PR now includes:
|
2 tasks
mikkihugo
added a commit
to mikkihugo/tree-sitter-markdown
that referenced
this pull request
Oct 14, 2025
Fixes tree-sitter-grammars#206 ## Problem When parsing links with dollar signs in the text, like: `[$NVIM_APPNAME](https://example.com/$VAR)` The parser incorrectly interpreted `$` inside link text as the start of a LaTeX block, preventing the link from being parsed correctly. ## Root Cause The `_inline_base` grammar rule included `$.latex_block`, which was used in ALL inline contexts including inside link text (`_inline_element_no_link`). ## Solution Created a new `_inline_base_no_latex` rule that excludes LaTeX blocks, and modified the dynamic rule generation to use this variant when generating `_inline_element_no_link` rules (used inside link text). **Changes:** - Added `_inline_base_no_latex` rule without `$.latex_block` - Modified line 401 to use appropriate base rule based on context: - Inside links (`link=false`): Use `_inline_base_no_latex` - Outside links (`link=true`): Use `_inline_base` (with LaTeX) ## Testing ✅ All existing tests pass ✅ Links with `$` characters now parse correctly ✅ LaTeX still works outside of link text ## Additional Changes Upgraded to tree-sitter 0.25 to match latest ABI (same as tree-sitter-grammars#207): - Updated Cargo.toml dependencies - Updated parser.rs API calls Co-authored-by: Claude <noreply@anthropic.com>
|
Thanks for this contribution! What is the status of this PR? I'd love to use this library with the newer version of |
Collaborator
|
superseded by #216 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the tree-sitter dependency from 0.24 to 0.25, making tree-sitter-md compatible with the latest tree-sitter ecosystem.
Closes #205
Changes
0.24to0.25parse_with()withparse_with_options()walk()methodTesting
✅ All existing tests pass with tree-sitter 0.25:
can_load_block_grammarcan_load_inline_grammarmarkdown_cursortableinline_rangesBreaking Changes
None for library users. The public API remains unchanged. Only internal implementation updated to use newer tree-sitter APIs.
Benefits
Motivation
Many Rust projects (including workspaces) are upgrading to tree-sitter 0.25 and cannot use tree-sitter-md due to native library linking conflicts when both 0.24 and 0.25 are present. This update enables them to use the latest versions.
API Migration Details
The main change is in the
parse_with_optionsmethod signature:tree-sitter 0.24:
tree-sitter 0.25:
This aligns with tree-sitter's move away from timeout-based cancellation in favor of progress callbacks.