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/glost

v0.4.2

Published

GLOST word-level annotation plugin for syllst

Downloads

606

Readme

@syllst/glost

Remark plugin that enriches Syllst nodes with GLOST word-level annotations.

Installation

pnpm add @syllst/glost

Peer Dependencies

For full GLOST integration, install the glost packages:

pnpm add glost-core glost-processor

Usage

Basic Usage

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

// Create a transcription provider (example)
const thaiProvider = {
  getTranscription: (word: string, scheme: string) => {
    // Return transcription for the word
    return transcriptions[word]?.[scheme];
  },
  getDefaultScheme: () => 'paiboon+',
};

// Configure the processor
const processor = createMDXParser()
  .use(remarkSyllabusDirectives)
  .use(remarkSyllstGlost, {
    languages: [
      {
        lang: 'th',
        transcriptionProvider: thaiProvider,
        defaultScheme: 'paiboon+',
      },
    ],
    defaultLang: 'th',
    targets: ['vocabularyItem', 'dialogueTurn'],
  });

// Process MDX content
const result = await processor.process(mdxContent);

With @laeng Language Packages

import { remarkSyllstGlost } from '@syllst/glost';
import { createThaiTranscriptionProvider } from '@laeng/th';

const processor = createMDXParser()
  .use(remarkSyllabusDirectives)
  .use(remarkSyllstGlost, {
    languages: [
      {
        lang: 'th',
        transcriptionProvider: createThaiTranscriptionProvider(),
        defaultScheme: 'paiboon+',
      },
    ],
    defaultLang: 'th',
  });

API

remarkSyllstGlost(options?)

Remark plugin that enriches syllst nodes with transcription data.

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | languages | LanguageProviderConfig[] | [] | Language provider configurations | | defaultLang | string | 'en' | Default language for content without explicit lang | | targets | EnrichTarget[] | ['all'] | Node types to enrich: 'vocabularyItem', 'dialogueTurn', 'example', 'all' | | skipExisting | boolean | true | Skip nodes that already have transcription | | schemes | string[] | Provider default | Transcription schemes to generate | | wordLevelDialogue | boolean | false | Enable word-level GLOST annotations for dialogue | | sentenceLevelDialogue | boolean | false | Enable sentence-level GLOST annotations for dialogue |

LanguageProviderConfig

interface LanguageProviderConfig {
  lang: string;                              // Language code (e.g., 'th', 'ja')
  transcriptionProvider?: TranscriptionProvider;
  defaultScheme?: string;                    // Default transcription scheme
}

TranscriptionProvider

interface TranscriptionProvider {
  getTranscription(word: string, scheme: string): string | undefined;
  getTranscriptions?(word: string): Record<string, string> | undefined;
  getDefaultScheme?(): string;
}

createProviderRegistry(configs)

Creates a language provider registry from an array of configurations.

import { createProviderRegistry } from '@syllst/glost/providers';

const registry = createProviderRegistry([
  { lang: 'th', transcriptionProvider: thaiProvider },
  { lang: 'ja', transcriptionProvider: japaneseProvider },
]);

registry.get('th');      // Returns Thai provider config
registry.has('ja');      // true
registry.getLanguages(); // ['th', 'ja']

LanguageProviderRegistry

Class for managing language providers.

import { LanguageProviderRegistry } from '@syllst/glost/providers';

const registry = new LanguageProviderRegistry();
registry.register({ lang: 'th', transcriptionProvider });
registry.get('th-TH'); // Falls back to 'th' if 'th-TH' not found

Enrichers

For advanced usage, individual enrichers are available:

import {
  enrichVocabularyItem,
  enrichDialogueTurn,
  enrichExample,
} from '@syllst/glost/enrichers';

How It Works

  1. The plugin runs after remarkSyllabusDirectives in the unified pipeline
  2. It visits all nodes matching the configured targets
  3. For each node, it:
    • Detects the language (from node, parent, or default)
    • Looks up the appropriate language provider
    • Calls the transcription provider to get transcription data
    • Enriches the node's transcription field

Transcription Output

Single scheme:

node.transcription = "sawatdee";

Multiple schemes:

node.transcription = {
  primary: "sawatdee",
  paiboon: "sà-wàt-dee",
  ipa: "/sà.wàt.diː/",
  rtgs: "sawatdi"
};

Metadata

After processing, metadata is attached to the vfile:

const result = await processor.process(content);
const meta = result.data.syllstGlost;

console.log(meta.nodesEnriched);   // Number of nodes enriched
console.log(meta.processingTime);  // Time in ms
console.log(meta.results);         // Detailed per-node results

License

MIT