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

woodml-parser

v1.0.0

Published

Reference parser for WoodML woodworking markup language

Readme

WoodML Parser (TypeScript)

Reference implementation of the WoodML parser for TypeScript/JavaScript.

Installation

npm install woodml-parser

CLI Usage

After installation, the woodml command is available:

# Parse and display project info
woodml parse project.woodml

# Generate a cut list
woodml cutlist project.woodml -f table

# Validate a file
woodml validate project.woodml

# Show project information
woodml info project.woodml -f json

# Generate SVG diagram
woodml diagram project.woodml -o diagram.svg

# Generate exploded view with blueprint colors
woodml diagram project.woodml -t exploded -c blueprint -o exploded.svg

# Generate cut list layout diagram
woodml diagram project.woodml -t cutlist -o cutlist.svg

CLI Options

  • -o, --output <file> - Write output to file instead of stdout
  • -f, --format <fmt> - Output format: json, text, table (default: text)
  • -v, --verbose - Show detailed output
  • -h, --help - Show help message

Diagram Options

  • -t, --type <type> - Diagram type: parts, exploded, cutlist (default: parts)
  • -c, --color <scheme> - Color scheme: default, blueprint, monochrome
  • -w, --width <px> - SVG width in pixels (default: 800)
  • --height <px> - SVG height in pixels (default: 600)

Library Usage

import {
  parse,
  parseAndResolve,
  validateDocument,
  generateCutList,
  formatCutList,
  calculateBoardFeet
} from 'woodml-parser';

// Parse a WoodML file
const doc = parse(woodmlSource);

// Parse and resolve all variables
const resolved = parseAndResolve(woodmlSource);

// Validate document
const errors = validateDocument(doc);

// Generate cut list
const cutList = generateCutList(resolved);
console.log(formatCutList(cutList));

// Calculate total board feet
const boardFeet = calculateBoardFeet(resolved);

Working with Dimensions

import {
  parseDimension,
  toInches,
  toMillimeters,
  formatImperial,
  formatMetric
} from 'woodml-parser';

// Parse various dimension formats
const dim1 = parseDimension('24"');        // 24 inches
const dim2 = parseDimension('3-1/2"');     // 3.5 inches
const dim3 = parseDimension("6'4\"");      // 76 inches
const dim4 = parseDimension('610mm');      // 610 millimeters
const dim5 = parseDimension('4/4');        // 1 inch (quarter notation)

// Convert between units
const inches = toInches(dim4);  // 24.0157...
const mm = toMillimeters(dim1); // 609.6

// Format for display
console.log(formatImperial(dim1)); // "2'"
console.log(formatMetric(dim4));   // "61cm"

Working with Formulas

import { createContext, evaluateFormula, resolveFormulas } from 'woodml-parser';

// Create a context with variables
const ctx = createContext({
  width: '24"',
  depth: '18"',
  height: '30"',
});

// Evaluate formulas
const area = evaluateFormula('$width * $depth', ctx);
const diagonal = evaluateFormula('diagonal($width, $depth)', ctx);

// Available functions:
// Math: min, max, abs, sqrt, round, floor, ceil, sin, cos, tan
// Woodworking: board_feet, square_feet, miter_angle, diagonal, golden_ratio

API Reference

Parser Functions

  • parse(source: string): WoodMLDocument - Parse WoodML source
  • parseAndResolve(source: string): ResolvedDocument - Parse and resolve variables
  • validateDocument(doc: WoodMLDocument): ValidationError[] - Validate document

Cut List Functions

  • generateCutList(doc: ResolvedDocument): CutListItem[] - Generate cut list
  • formatCutList(items: CutListItem[]): string - Format as table
  • calculateBoardFeet(doc: ResolvedDocument): number - Calculate total board feet

Unit Functions

  • parseDimension(input: string): Dimension - Parse dimension string
  • toInches(dim: Dimension): number - Convert to inches
  • toMillimeters(dim: Dimension): number - Convert to millimeters
  • formatImperial(dim: Dimension): string - Format as imperial
  • formatMetric(dim: Dimension): string - Format as metric

SVG Generation

  • generateSVG(doc, type?, options?) - Generate SVG diagram
  • generatePartSVG(part, options?) - Generate SVG for single part
  • SVGGenerator - Class for fine-grained control
import { parseAndResolve, generateSVG, SVGGenerator } from 'woodml-parser';

const doc = parseAndResolve(source);

// Quick generation
const svg = generateSVG(doc, 'parts', { colorScheme: 'blueprint' });

// Using the generator class
const generator = new SVGGenerator({
  width: 1200,
  height: 800,
  showDimensions: true,
  showGrain: true,
  colorScheme: 'default',
});

const partsDiagram = generator.generatePartsDiagram(doc);
const explodedView = generator.generateExplodedView(doc);
const cutlistLayout = generator.generateCutListDiagram(doc, 48, 96);

License

MIT