3.1.0 • Published 5 years ago

commonmark-to-commonform v3.1.0

Weekly downloads
4
License
BlueOak-1.0.0
Repository
github
Last release
5 years ago

commonmark-to-commonform

convert CommonMark to Common Form

This package includes a JavaScript module and command-line filter.

JavaScript

var toCommonForm = require('commonmark-to-commonform')
var assert = require('assert')

assert.deepEqual(
  toCommonForm(
    [
      '# First Heading',
      '',
      'This is the **Agreement**.',
      '',
      '# Second Heading',
      '',
      '- Using the term _Agreement_.',
      '- Referencing [First Heading](#first-heading).',
    ].join('\n')
  ).form,
  {
    content: [
      {
        heading: 'First Heading',
        form: {
          content: [
            'This is the ', {definition: 'Agreement'}, '.'
          ]
        }
      },
      {
        heading: 'Second Heading',
        form: {
          content: [
            {
              form: {
                content: [
                  'Using the term ', {use: 'Agreement'}, '.'
                ]
              }
            },
            {
              form: {
                content: [
                  'Referencing ', {reference: 'First Heading'}, '.'
                ]
              }
            }
          ]
        }
      }
    ]
  }
)

CLI

npx commonmark-to-commonform < terms.md > terms.json
3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-beta.1

5 years ago