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

@unrdf/kgc-docs

v26.4.4

Published

KGC Markdown parser and dynamic documentation generator with proof anchoring

Readme

@unrdf/kgc-docs

KGC Markdown parser and dynamic documentation generator with cryptographic proof anchoring.

Features

  • YAML Frontmatter Parsing: Parse o_hash, policy_id, bounds, receipts, views, sources
  • Specialized Fenced Blocks: Support for kgc:query, kgc:proof, kgc:extract, kgc:render
  • Deterministic AST: Build consistent abstract syntax trees from markdown
  • 4 Diataxis Views: Generate tutorials, how-to, reference, and explanations
  • Merkle Proof Generation: Create cryptographic proof trees with receipt hashing
  • O-Hash Linkage: Link receipts to root hash for verification
  • CLI Tool: Build, verify, refresh, and prove documentation

Installation

pnpm add @unrdf/kgc-docs

Quick Start

1. Create a .kgcmd file

---
o_hash: my-doc-001
policy_id: policy-001
bounds: []
receipts: [receipt-001, receipt-002]
views: [tutorial, how-to, reference, explanation]
sources: []
---

# My Documentation

\`\`\`kgc:query
SELECT ?s ?p ?o WHERE { ?s ?p ?o }
\`\`\`

2. Build documentation

kgc-docs build docs/src docs

This generates 4 views:

  • docs/tutorials/my-doc.md
  • docs/how-to/my-doc.md
  • docs/reference/my-doc.md
  • docs/explanations/my-doc.md

3. Verify proofs

kgc-docs verify docs

4. Generate proof trees

kgc-docs prove docs/src proofs

API

Parser

import { parseKGCMarkdown, buildAST } from '@unrdf/kgc-docs/parser';

const markdown = '...';
const ast = parseKGCMarkdown(markdown);

Renderer

import { renderDiataxisView } from '@unrdf/kgc-docs/renderer';

const tutorial = renderDiataxisView(ast, 'tutorial');
const reference = renderDiataxisView(ast, 'reference');

Proof

import { generateProofTree, verifyProof } from '@unrdf/kgc-docs/proof';

const proof = generateProofTree(ast);
const isValid = verifyProof(proof, ast);

CLI Commands

# Build documentation
kgc-docs build [sourceDir] [outputDir]

# Verify proof appendices
kgc-docs verify [outputDir]

# Rebuild all docs
kgc-docs refresh [sourceDir] [outputDir]

# Generate proof trees
kgc-docs prove [sourceDir] [proofsDir]

Proof Structure

Each generated document includes a proof appendix:

## Proof Appendix

### Verification Data

\`\`\`json
{
"merkle_root": "abc123...",
"o_hash": "my-doc-001",
"receipt_count": 2,
"timestamp": "2025-12-27T00:00:00.000Z"
}
\`\`\`

### Receipt Hashes

- `receipt-001`
- `receipt-002`

### O-Hash Linkage

The document is cryptographically linked to o_hash `my-doc-001` via Merkle tree.

Test Results

All 41 tests passing:

  • ✅ Frontmatter parsing with Zod validation
  • ✅ Fenced block parsing (query, proof, extract, render)
  • ✅ Deterministic AST generation
  • ✅ 4 Diataxis view rendering
  • ✅ Proof appendix generation
  • ✅ Merkle tree creation
  • ✅ Proof verification
  • ✅ Receipt-to-hash linkage

Architecture

packages/kgc-docs/
├── src/
│   ├── kgc-markdown.mjs    # Main entry point
│   ├── parser.mjs           # YAML + fenced block parser
│   ├── renderer.mjs         # Diataxis view renderer
│   └── proof.mjs            # Merkle tree + verification
├── bin/
│   └── kgc-docs.mjs        # CLI tool
└── test/
    ├── kgc-markdown.test.mjs  # Vitest tests
    └── run-tests.mjs          # Standalone test runner

License

MIT