A semantic parser for ProseMirror/TipTap content structures that helps bridge the gap between natural content writing and component-based web development.
npm install @uniwebcms/semantic-parser
const { parseContent } = require("@uniwebcms/semantic-parser");
// Your ProseMirror/TipTap document
const doc = {
type: "doc",
content: [
{
type: "heading",
attrs: { level: 1 },
content: [{ type: "text", text: "Title" }],
},
// ...more content
],
};
// Parse the content
const parsed = parseContent(doc);
// Access different views of the content
console.log(parsed.sequence); // Flat sequence of elements
console.log(parsed.groups); // Content organized into semantic groups
console.log(parsed.byType); // Content organized by element type
See Content Writing Guide for detailed information about content structuring conventions.
Apache License 2.0