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

Release v0.1.0 #2

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

This package is inspired by @yuin's [`goldmark`](https://github.com/yuin/goldmark) and is designed to be as clear and extensible.

The implementation follows the official [Jupyter Notebook format spec](https://nbformat.readthedocs.io/en/latest/format_description.html#the-notebook-file-format) (`nbformat`) and produces an output similar to that of [`nbconvert`](https://github.com/jupyter/nbconvert) (Jupyter's team own reference implementation) both structurally and visually.
The implementation follows the official [Jupyter Notebook format spec](https://nbformat.readthedocs.io/en/latest/format_description.html#the-notebook-file-format) (`nbformat`) and produces an output similar to that of [`nbconvert`](https://github.com/jupyter/nbconvert) (Jupyter's team own reference implementation) both structurally and visually.

Although the current release only supports `v4.4` notebooks, support for other formats will be added soon (see the [**Roadmap**](#roadmap)).
Although the current release only supports `v4.4` notebooks, support for other formats will be added soon (see the [**Roadmap**](#roadmap-)).
The package comes with an HTML renderer out of the box and can be extended to convert notebooks to other formats, such as LaTeX or PDF.

> 🏗 This package is being actively developed: its structure and APIs might change overtime.
Expand Down
2 changes: 0 additions & 2 deletions convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package nb
import (
"io"

_ "github.com/bevzzz/nb/schema/v4"

"github.com/bevzzz/nb/decode"
"github.com/bevzzz/nb/render"
"github.com/bevzzz/nb/render/html"
Expand Down
2 changes: 1 addition & 1 deletion render/html/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ func (attrs attributes) WriteTo(w io.Writer) (n64 int64, err error) {
return sorted[i].Key < sorted[j].Key
})

// class=""
for _, attr := range sorted {
s := " "
if attr.IsBool {
// FIXME: 'continue' prevents the attribute from being written.
s += attr.Key
continue
}
Expand Down
2 changes: 1 addition & 1 deletion render/html/wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ func (n *node) cmp(other *stdhtml.Node, status *htmlDiff) {
}
}

// findFirst fast-forwards to the first ocurrence of the <target> node and returns it.
// findFirst fast-forwards to the first occurrence of the <target> node and returns it.
// If the node is not in the tree, it will return nil.
func findFirst(n *stdhtml.Node, target string) *stdhtml.Node {
if n.Type == stdhtml.ElementNode && n.Data == target {
Expand Down
4 changes: 2 additions & 2 deletions render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Renderer interface {
// Render writes the contents of the notebook cells it supports.
//
// Implementations should not error on cell types, for which no RenderCellFunc is registered.
// This is expected, as some [RawCells] will be renderered in some output formats and ignored in others.
// This is expected, as some [RawCells] will be rendered in some output formats and ignored in others.
//
// [RawCells]: https://nbformat.readthedocs.io/en/latest/format_description.html#raw-nbconvert-cells
Render(io.Writer, schema.Notebook) error
Expand Down Expand Up @@ -101,7 +101,7 @@ func (r *renderer) AddOptions(opts ...Option) {

// Register registers a new RenderCellFunc for the cell type.
//
// Any previously registered functions will be overriden. All configurations
// Any previously registered functions will be overridden. All configurations
// should be done the first call to Render(), as later changes will have no effect.
func (r *renderer) Register(t schema.CellTypeMixed, f RenderCellFunc) {
r.renderCellFuncsTmp[t] = f
Expand Down
2 changes: 1 addition & 1 deletion schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Cell interface {
MimeType() string
Text() []byte

// Type will be superceeded with CellType in the following commits.
// Type will be superseded with CellType in the following commits.
Type() CellTypeMixed
}

Expand Down
11 changes: 11 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package nb

import (
// Currently supported nbformat versions:
_ "github.com/bevzzz/nb/schema/v4"
)

// Version returns current release version.
func Version() string {
return "v0.1.0"
}