Skip to content

feat: Implement source mapping for elements and enhance inline parsing - #275

Merged
frostming merged 2 commits into
masterfrom
feat/source-span
Aug 12, 2026
Merged

feat: Implement source mapping for elements and enhance inline parsing#275
frostming merged 2 commits into
masterfrom
feat/source-span

Conversation

@frostming

Copy link
Copy Markdown
Owner
  • 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

- 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

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.56198% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.72%. Comparing base (c898b78) to head (d2c06a0).

Files with missing lines Patch % Lines
marko/element.py 84.00% 4 Missing and 8 partials ⚠️
marko/block.py 95.65% 0 Missing and 2 partials ⚠️
marko/source.py 80.00% 1 Missing and 1 partial ⚠️
marko/ext/gfm/elements.py 97.72% 0 Missing and 1 partial ⚠️
marko/inline.py 96.77% 0 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
unittests 95.72% <92.56%> (-0.43%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread marko/inline_parser.py
Comment thread examples/demo.html Outdated
@frostming
frostming merged commit 5456f1f into master Aug 12, 2026
18 of 21 checks passed
@frostming
frostming deleted the feat/source-span branch August 12, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Source mapping info

1 participant