feat: Implement source mapping for elements and enhance inline parsing - #275
Merged
Conversation
- Introduced `_SourceMap` class for compact mapping of parsed-text offsets to source offsets. - Added `source_span` and `syntax_spans` attributes to `Element` class for tracking source positions. - Enhanced inline elements to include source position attributes such as `dest_span` and `title_span`. - Updated parsing logic in `Parser` and `inline_parser` to support source position tracking. - Added tests for source mapping functionality, covering various block and inline elements. - Ensured that source positions are normalized and accurately reflect the original text structure. Close #273 Signed-off-by: Frost Ming <me@frostming.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #275 +/- ##
==========================================
- Coverage 96.15% 95.72% -0.43%
==========================================
Files 21 21
Lines 2107 2317 +210
Branches 305 337 +32
==========================================
+ Hits 2026 2218 +192
- Misses 42 47 +5
- Partials 39 52 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b63e6e8c71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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.
_SourceMapclass for compact mapping of parsed-text offsets to source offsets.source_spanandsyntax_spansattributes toElementclass for tracking source positions.dest_spanandtitle_span.Parserandinline_parserto support source position tracking.Close #273
Signed-off-by: Frost Ming me@frostming.com