NCMalpha 0.1.0

A structured markdown format for semantic parsing and deterministic document processing. NCM extends CommonMark with YAML frontmatter, a two-stage parsing pipeline that produces typed Element[] and Block[] with deterministic identity, and a promotion engine that detects patterns like admonitions, task lists, and diagrams. Zero dependencies beyond yaml and zod.

parse.ts
import { parseNcm, buildBlocks } from "@nuucognition/ncm"// Parse any markdown documentconst doc = parseNcm(markdown)// Build semantic blocks with IDsconst blocks = buildBlocks(doc.elements)// Deterministic block identityconst header = blocks[0] // → { id: "b1", type: "header" }// Validate against NCM schemaconst result = validate(blocks)
npm i @nuucognition/ncm
Source
---
nc_version: 0.1.0
title: My Document
tags: ["#doc"]
---

# Hello World

A short paragraph.

```ts
parseNcm(md)
```
parse
Metadata
nc_version:0.1.0
title:"My Document"
tags:["#doc"]
Elements
headerlevel: 1
paragraph1 line
codelang: ts
build
Blocks
b1header#hello-world
b2paragraph
b3code

Frontmatter is extracted as structured metadata. The body is parsed into syntactic elements, then assembled into semantic blocks with deterministic IDs.

Parse PipelineSource markdown flows through a two-stage pipeline into semantic blocks.