Documentation ¶
Overview ¶
Package quiver implements a simple library for parsing quiver libraries, notebooks and notes.
The most straightforward way to use it is to load a library from disk, and then iterate the object tree:
lib, _ := quiver.ReadLibrary("/path/to/library.quiverlibrary", false) // Print the title of all the notes in all the notebooks for _, notebooks := range lib.Notebooks { for _, note := notebook.Notes { fmt.Println(n.Title) //... } }
Index ¶
- Constants
- func IsLibrary(path string) (bool, error)
- func IsNote(path string) (bool, error)
- func IsNotebook(path string) (bool, error)
- type Cell
- type CellType
- type Library
- type LibraryMetadata
- type Note
- type NoteContent
- type NoteMetadata
- type NoteResource
- type Notebook
- type NotebookHierarchyInfo
- type NotebookMetadata
- type TimeStamp
Constants ¶
const Version = "0.3.5"
The version of the quiver package
Variables ¶
This section is empty.
Functions ¶
func IsLibrary ¶
IsLibrary checks that the element at the given path is indeed a Quiver library, and returns true if found or false with an error otherwise.
func IsNote ¶
IsNote checks that the element at the given path is indeed a Quiver note, and returns true if found or false with an error otherwise.
func IsNotebook ¶
IsNoteBook checks that the element at the given path is indeed a Quiver notebook, and returns true if found or false with an error otherwise.
Types ¶
type Cell ¶
type Cell struct { // The type of the cell. Type CellType `json:"type"` // The language of the cell: only relevant for CodeCell cells. Language string `json:"language,omitempty"` // The type of diagram: only relevant for DiagramCell cells. DiagramType string `json:"diagramType,omitempty"` // The data for the cell, aka. all the actual content. Data string `json:"data"` }
A cell inside a Quiver note.
func (*Cell) IsMarkdown ¶
IsMarkdown returns true if the Cell is of Type MarkdownCell.
type Library ¶
type Library struct { *LibraryMetadata // The list of Notebooks found inside the Library. Notebooks []*Notebook `json:"notebooks"` }
Library represents the contents of a Quiver library (.qvlibrary) file.
func ReadLibrary ¶
ReadLibrary loads the Quiver library at the given path. The loadResources parameter tells the function if note resources should be loaded too.
type LibraryMetadata ¶
type LibraryMetadata struct { // The root of the notebook hierarchy Children []NotebookHierarchyInfo `json:"children"` }
LibraryMetadata represents the contents of a Quiver library metadata (meta.json) file.
func ParseLibraryMetadata ¶
func ParseLibraryMetadata(r io.Reader) (*LibraryMetadata, error)
ParseLibraryMetadata loads the JSON from the given stream into a LibraryMetadata.
func ReadLibraryMetadata ¶
func ReadLibraryMetadata(path string) (*LibraryMetadata, error)
ReadLibraryMetadata loads the library "meta.json" at the given path.
type Note ¶
type Note struct { *NoteMetadata *NoteContent // The list of all Resources attached to this Note. Resources []*NoteResource `json:"resources,omitempty"` }
NoteContent represents the contents of a Quiver note (.qvnote) directory.
type NoteContent ¶
type NoteContent struct { // The list of all cells in the note. Cells []*Cell `json:"cells"` }
NoteContent represents the contents of a Quiver not content (content.json) file.
Beware: this structure does note contain the Title of the cell, since it is already held in the NoteMetadata file.
func ParseContent ¶
func ParseContent(r io.Reader) (*NoteContent, error)
ParseNoteMetadata loads the JSON from the given stream into a NoteContent.
func ReadNoteContent ¶
func ReadNoteContent(path string) (*NoteContent, error)
ReadNoteContent loads the note "content.json" at the given path.
type NoteMetadata ¶
type NoteMetadata struct { // The time the note was created. CreatedAt TimeStamp `json:"created_at"` // A list of tags attached to the Note. Tags []string `json:"tags"` // The Title of the Note. Title string `json:"title"` // The time the note was last updated. UpdatedAt TimeStamp `json:"updated_at"` // The UUID of the Note. UUID string `json:"uuid"` }
NoteMetadata represents the contents of a Quiver note metadata (meta.json) file.
func ParseNoteMetadata ¶
func ParseNoteMetadata(r io.Reader) (*NoteMetadata, error)
ParseNoteMetadata loads the JSON from the given stream into a NoteMetadata.
func ReadNoteMetadata ¶
func ReadNoteMetadata(path string) (*NoteMetadata, error)
ReadNoteResource loads the note "meta.json" at the given path.
type NoteResource ¶
type NoteResource struct { // The file name. Name string `json:"name"` // The file relative path. Rel string `json:"rel"` // The file data as raw bytes. // It serializes in JSON as a data URI. Data []byte `json:"data"` }
NoteContent represents the contents of a Quiver note resource: any file found under the resources/ folder in the note.
func ReadNoteResources ¶
func ReadNoteResources(path string, rel string) ([]*NoteResource, error)
ReadNoteResource loads the resource (any file actually) into a NoteResource instance.
func (*NoteResource) MarshalJSON ¶
func (n *NoteResource) MarshalJSON() ([]byte, error)
MarshalJSON marshals
func (*NoteResource) UnmarshalJSON ¶
func (u *NoteResource) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals NoteResource from data:// url
type Notebook ¶
type Notebook struct { *NotebookMetadata // The list of Notes found inside the Notebook. Notes []*Note `json:"notes"` }
Notebook represents the contents of a Quiver notebook (.qvnotebook) directory.
type NotebookHierarchyInfo ¶
type NotebookHierarchyInfo struct { // The UUID of the Notebook. UUID string `json:"uuid"` // The list of its children Children []NotebookHierarchyInfo `json:"children"` }
A note in the Quote notebooks hierarchy
type NotebookMetadata ¶
type NotebookMetadata struct { // The Name of the Notebook. Name string `json:"name"` // The UUID of the Notebook. UUID string `json:"uuid"` }
NotebookMetadata represents the contents of a Quiver notebook (.qvnotebook) directory.
func ParseNotebookMetadata ¶
func ParseNotebookMetadata(r io.Reader) (*NotebookMetadata, error)
ParseNotebookMetadata loads the JSON from the given stream into a NotebookMetadata.
func ReadNotebookMetadata ¶
func ReadNotebookMetadata(path string) (*NotebookMetadata, error)
ReadNotebookMetadata loads the notebook "meta.json" at the given path.
type TimeStamp ¶
A timestamp in a Quiver note metadata file (meta.json). It holds time info (from time.Time) and marshals as an integer.
func (*TimeStamp) MarshalJSON ¶
MarshalJSON marshals TimeStamp as an integer (seconds since Epoch).
func (*TimeStamp) UnmarshalJSON ¶
MarshalJSON unmarshals TimeStamp from an integer (seconds since Epoch).
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
quiver_to_json
The quiver_to_json tool loads a provided Quiver library into a single JSON.
|
The quiver_to_json tool loads a provided Quiver library into a single JSON. |
quiver_to_markdown
The quiver_to_markdown converts a Quiver library into a set of Markdown files.
|
The quiver_to_markdown converts a Quiver library into a set of Markdown files. |