npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@syllst/processor

v0.5.6

Published

MDX parsing and transformation pipeline for syllst

Readme

@syllst/processor

MDX parsing and transformation pipeline for syllst — converts MDX-authored curriculum content into structured, validated syntax trees.

Overview

This is where the transformation happens. The processor takes MDX content with custom directives and produces a validated syllst Unist tree.

MDX Content → remark-parse → MDAST → remark-syllabus-directives → Syllst Unist Tree → Zod Validation

Installation

pnpm add @syllst/processor

Usage

Build a Lesson from MDX

import { buildLessonFromMDX } from '@syllst/processor';

const mdx = `
---
type: lesson
id: lesson-01
title: "Basic Greetings"
order: 1
difficulty: beginner
cefrLevel: A1
---

:::vocabulary-set{id="greetings" title="Basic Greetings"}
::vocab{word="สวัสดี" transcription="sawatdee" translation="Hello"}
::
:::

:::grammar-rule{id="particles" title="Polite Particles"}
Thai uses gender-specific polite particles.
:::

:::phonological-rule{id="tone-mid" title="Middle-Class Tones" ruleType="tone"}
Middle-class consonants produce all 5 tones.
::rule-condition{condition='{"consonantClass":"middle","toneMark":"none"}' result="mid" example="กา"}
::
:::
`;

const lesson = await buildLessonFromMDX(mdx);
// Returns a validated LessonAstNode

Use the Remark Plugin Directly

import { createMDXParser } from '@syllst/processor/builders';
import { remarkSyllabusDirectives } from '@syllst/processor/plugins';

const parser = createMDXParser()
  .use(remarkSyllabusDirectives);

const tree = await parser.run(parser.parse(mdxContent));

Validation

import { validateLesson } from '@syllst/processor/validators';

const result = validateLesson(lesson);
if (!result.valid) {
  console.error(result.errors);
}

Supported Directives

Container Directives (:::)

| Directive | Produces | Children | |-----------|----------|----------| | :::grammar-rule | GrammarRuleNode | Examples, content | | :::vocabulary-set | VocabularySetNode | Vocabulary items | | :::character-set | CharacterSetNode | Character items | | :::example-set | ExampleSetNode | Examples | | :::dialogue | DialogueNode | Dialogue turns | | :::exercise | ExerciseNode | Content | | :::phonological-rule | PhonologicalRuleNode | Rule conditions, examples | | :::syllable-pattern | SyllablePatternNode | Pattern examples, content | | :::writing-pattern | WritingPatternNode | Examples, content |

Leaf Directives (::)

| Directive | Produces | |-----------|----------| | ::vocab | VocabularyItemNode | | ::character | CharacterItemNode | | ::example | ExampleNode | | ::dialogue-turn | DialogueTurnNode | | ::rule-condition | RuleConditionNode | | ::pattern-example | PatternExampleNode |

Subpath Exports

| Import | Contents | |--------|----------| | @syllst/processor | Everything (types, builders, plugins, validators, utils) | | @syllst/processor/builders | buildLessonFromMDX, createMDXParser, extractFrontmatter | | @syllst/processor/plugins | remarkSyllabusDirectives remark plugin | | @syllst/processor/validators | validateLesson, Zod-based validation | | @syllst/processor/utils | Tree traversal and text extraction utilities | | @syllst/processor/config | Pipeline configuration |

Pipeline Steps

  1. MDX Parsing — Parse MDX string into MDAST using remark
  2. Frontmatter Extraction — Extract YAML frontmatter as lesson metadata
  3. Directive TransformationremarkSyllabusDirectives converts custom directives (:::, ::) into syllst node types
  4. Tree Building — MDAST transformed into syllst Unist tree
  5. Validation — Optional Zod schema validation

Development

pnpm test        # Run tests (37 tests)
pnpm build       # Build TypeScript
pnpm typecheck   # Type check

License

MIT