Use Curvenote - logo

NPM Version MIT License GitHub Stars Twitter Follow


Schema for interactive scientific writing, with translations to MyST flavoured markdown, LaTeX, and HTML.

Overview & Goals



The schema has Nodes and Marks where Nodes are basically a block of content (paragraph, code, etc.), and Marks are inline modifications to the content (bold, emphasis, links, etc.). See the ProseMirror docs for a visual explanation.

Overview of Nodes

Overview of Marks

Simple Example

This moves from markdown --> JSON --> HTML. The JSON is the intermediate representation for @curvenote/editor.

import { Schema, nodes, marks, fromMarkdown, toHTML } from '@curvenote/schema'; import { JSDOM } from 'jsdom'; const schema = new Schema({ nodes, marks }); const content = '# Hello `@curvenote/schema`!'; const doc = fromMarkdown(content, schema); console.log(doc.toJSON()); >> { "type": "doc", "content": [ { "type": "heading", "attrs": { "level": 1 }, "content": [ { "type": "text", "text": "Hello " }, { "type": "text", "marks": [ { "type": "code" } ], "text": "@curvenote/schema" }, { "type": "text", "text": "!" } ] } ] } // Assuming we are in node, just use `document` if in a browser! const { document } = new JSDOM('').window; // Now move the document back out to html const html = toHTML(doc, schema, document); console.log(html); >> "<h1>Hello <code>@curvenote/schema</code>!</h1>"


See also:

Made with love by Curvenote
Last updated February 19th, 2021