diff --git a/README.md b/README.md index ab867a4..b89bd5d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/convert.go b/convert.go index b64a73f..6ec265d 100644 --- a/convert.go +++ b/convert.go @@ -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" diff --git a/render/html/wrapper.go b/render/html/wrapper.go index ff6f883..e3b186e 100644 --- a/render/html/wrapper.go +++ b/render/html/wrapper.go @@ -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 } diff --git a/render/html/wrapper_test.go b/render/html/wrapper_test.go index 87767e0..42f0a17 100644 --- a/render/html/wrapper_test.go +++ b/render/html/wrapper_test.go @@ -681,7 +681,7 @@ func (n *node) cmp(other *stdhtml.Node, status *htmlDiff) { } } -// findFirst fast-forwards to the first ocurrence of the node and returns it. +// findFirst fast-forwards to the first occurrence of the 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 { diff --git a/render/render.go b/render/render.go index 862333c..8be3db5 100644 --- a/render/render.go +++ b/render/render.go @@ -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 @@ -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 diff --git a/schema/schema.go b/schema/schema.go index b8c8556..a1aaffb 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -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 } diff --git a/version.go b/version.go new file mode 100644 index 0000000..c0ba179 --- /dev/null +++ b/version.go @@ -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" +}