Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension API #3

Merged
merged 6 commits into from
Jan 23, 2024
Merged

Extension API #3

merged 6 commits into from
Jan 23, 2024

Conversation

bevzzz
Copy link
Owner

@bevzzz bevzzz commented Jan 21, 2024

This PR introduces the new Extension API.
It offers a clear nb.Extension interface that other packages can implement to render richer content.

I've also made the Renderer more flexible with the new Preference API. With it, custom renderers can now select cells by their schema.CellType or even narrow it down to a specific mime-type. See example usages in html.go.
This is a breaking change, as it modifies the signature for Register() method and discontinues schema.CellTypeMixed.

This will allow flexible but precise mime-type matching
in the Preference API.
- Register CellRenderFuncs with render.Pref, which allows specifying
    both the cell type and the mime-type that the function should handle.
- Replace schema.CellTypeMixed with distinct Type() and MimeType()
    fields. The legacy solution blended the two properties, which made
    the public API for registerring RenderCellFuncs rigid and confusing.
- Move reusable test doubles to internal/test. After some more polishing
    I'm planning to expose them as a separate package to be used by extension
    packages in their tests.
@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2024

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (aafdae2) 80.00% compared to head (44d1ae8) 81.27%.

Files Patch % Lines
render/render.go 76.78% 10 Missing and 3 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #3      +/-   ##
==========================================
+ Coverage   80.00%   81.27%   +1.27%     
==========================================
  Files           5        7       +2     
  Lines         360      534     +174     
==========================================
+ Hits          288      434     +146     
- Misses         58       81      +23     
- Partials       14       19       +5     

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

@bevzzz bevzzz merged commit b2b0928 into main Jan 23, 2024
1 check passed
@bevzzz bevzzz deleted the feat/preference-api branch January 23, 2024 16:31
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.

2 participants