OMD Documentation

OMD Library Entry Point

This module (omd/core/index.js) serves as the main entry point for the OMD (Open Math Display) library. It re-exports all core classes, visualization components, and utility functions, making them easily accessible from a single import.

Overview

When you import from @teachinglab/omd (or directly from omd/core/index.js), you gain access to a comprehensive set of tools for building and manipulating mathematical expressions and their visual representations.

Named Exports

The primary way to use the library is through its named exports.

Core Node Classes

All classes extending omdNode are re-exported, allowing you to construct and work with various types of mathematical expressions:

Visualization Components

These classes provide high-level components for rendering and interacting with mathematical expressions:

Utilities

Essential utility functions and classes for parsing, simplification, and configuration management:

omdHelpers

A collection of convenience functions for common operations:

createNodeFromExpression(expression, mathjs)

createEquation(equationString)

createStepVisualizer(equationStrings)

Re-Exports

The index also re-exports all named exports from the following modules:

This means you can import their functions directly from the main entry point.

Default Export

The module also provides a default export, which is an object containing all the re-exported classes and functions, organized into logical groups (nodes, helpers, etc.). This allows for a more structured import if preferred.

import OMD from '@teachinglab/omd';

const equation = new OMD.nodes.omdEquationNode(...);
const display = new OMD.omdDisplay(...);
const helpers = OMD.helpers;

Example Usage

import { omdDisplay, omdEquationNode, omdHelpers } from '@teachinglab/omd';

// Create an equation using a helper
const equation = omdHelpers.createEquation('2x + 5 = 15');

// Create a display and render the equation
const displayContainer = document.getElementById('math-container');
const display = new omdDisplay(displayContainer);

display.render(equation);

// You can also directly access node classes
const constant = new omdConstantNode({ value: 10 });
↑ Top