How to use the commonmark.json.forEach function in commonmark

To help you get started, we’ve selected a few commonmark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remarkjs / remark-html / test / index.js View on Github external
test('CommonMark', function(t) {
  commonmark.forEach(function(test, n) {
    var name = test.section + ' ' + test.relative
    var file = vfile(name + '.md')
    var result
    var message
    var exception

    file.contents = test.markdown
    result = processSync(file, commonmarkOptions)

    n += 1

    try {
      assert.strictEqual(result, test.html)
    } catch (error) {
      exception = error
    }
github remarkjs / remark-vdom / test / index.js View on Github external
/*
 * Gather fixtures.
 */

fixtures = fixtures.filter(isHidden);
integrations = integrations.filter(isHidden);

/*
 * CommonMark.
 */

var section;
var start;

commonmark.forEach(function (test, position) {
    if (section !== test.section) {
        section = test.section;
        start = position;
    }

    test.relative = position - start + 1;
});

/**
 * Transform VDOM to HTML.
 *
 * @param {Array.} nodes - List of nodes.
 * @return {string} - Stringified HTML.
 */
function wrap(nodes) {
    var result = vdom2html(h('div', nodes));

commonmark

a strongly specified, highly compatible variant of Markdown

BSD-2-Clause
Latest version published 4 months ago

Package Health Score

77 / 100
Full package analysis