UNPKG

@curvenote/schema

Version:

Schema and markdown parser for @curvenote/editor

16 lines 615 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromText = void 0; const prosemirror_model_1 = require("prosemirror-model"); const schemas_1 = require("../../schemas"); function fromText(content, useSchema, document) { const schema = (0, schemas_1.getSchema)(useSchema); const div = document.createElement('div'); const pre = document.createElement('pre'); pre.textContent = content; div.append(pre); const doc = prosemirror_model_1.DOMParser.fromSchema(schema).parse(div); return doc; } exports.fromText = fromText; //# sourceMappingURL=index.js.map