Lint Equations

remark plugin to lint Markdown equation elements.

Usage

var lint = require( '@stdlib/_tools/remark/plugins/remark-lint-equations' );

lint()

Attaches a remark plugin which, when provided a Markdown abstract syntax tree, lints equation elements.

var remark = require( 'remark' );

var str = '<!-- <equation class="equation" label="" align="center" raw="|x| = \begin{cases} x & \textrm{if}}\ x \geq 0 \\ -x & \textrm{{if}\ x < 0\end{cases}" alt=""> -->\n\n<!-- </equation> -->';

remark().use( lint ).process( str, done );

function done( error, file ) {
    var i;
    if ( error ) {
        throw error;
    }
    for ( i = 0; i < file.messages.length; i++ ) {
        console.error( file.messages[ i ].message );
    }
}

Examples

var join = require( 'path' ).join;
var remark = require( 'remark' );
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
var lint = require( '@stdlib/_tools/remark/plugins/remark-lint-equations' );

// Load a Markdown file:
var fpath = join( __dirname, 'examples', 'fixtures', 'file.txt' );
var file = readFileSync( fpath );

// Lint equations:
remark().use( lint ).process( file.toString(), done );

function done( error, file ) {
    var i;
    if ( error ) {
        throw error;
    }
    for ( i = 0; i < file.messages.length; i++ ) {
        console.error( file.messages[ i ].message );
    }
}