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

Built-in extensions #4

Merged
merged 8 commits into from
Jan 26, 2024
Merged

Built-in extensions #4

merged 8 commits into from
Jan 26, 2024

Conversation

bevzzz
Copy link
Owner

@bevzzz bevzzz commented Jan 24, 2024

As the Roadmap mentions, v0.2.0 is going to feature several extensions to improve the quality of the generated HTML.

This PR adds adapters for several popular packages that can now be passed as external dependencies:

  • extension.NewMarkdown allows using goldmark, blackfriday (or any custom function for that matter) to render markdown cells
  • extension.AnsiHtml allows using ansihtml to convert ANSI colours in "stream" and "error" output cells to styled HTML.
  • package pkg/test provides useful test doubles and helper functions (previously internal/test)

These helper functions are well-suited
for testing extensions, which requires
mocking schema.Cell and schema.Notebook.
This allows other packages to pass their own Option implementations
without relying on the unexported *renderer.
These are the 2 most popular Markdown renderers,
which can no be passed as extensions and used to
render markdown cells (without actually pulling them
in as package deps)
@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2024

Codecov Report

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

Comparison is base (b2b0928) 81.27% compared to head (3d5fc77) 81.96%.

Files Patch % Lines
render/render.go 36.36% 6 Missing and 1 partial ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
+ Coverage   81.27%   81.96%   +0.68%     
==========================================
  Files           7       11       +4     
  Lines         534      571      +37     
==========================================
+ Hits          434      468      +34     
- Misses         81       83       +2     
- Partials       19       20       +1     

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

Collected all adapters in a single extension/adapter package, because
there is a lot of shared logic and structure and no naming clashes.
The testing package got the corresponding fixture and is now made public
(internal/test -> pkg/test) so that it can be used in external packages
providing nb extensions.
@bevzzz bevzzz force-pushed the feat/built-in-extensions branch from e090cd6 to 3d5fc77 Compare January 25, 2024 12:35
@bevzzz bevzzz marked this pull request as ready for review January 26, 2024 11:48
@bevzzz bevzzz merged commit d7249bd into main Jan 26, 2024
1 check passed
@bevzzz bevzzz deleted the feat/built-in-extensions branch January 26, 2024 17:25
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