Skip to content
This repository has been archived by the owner on Nov 10, 2019. It is now read-only.

Commit

Permalink
feat: make it compatible with mos@1
Browse files Browse the repository at this point in the history
BREAKING CHANGE: can not work with mos@0
  • Loading branch information
zkochan committed May 13, 2016
1 parent 62aef7b commit 3e1b391
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
11 changes: 3 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
'use strict'
module.exports = plugin
module.exports = (mos, md) => Object.assign(mos.scope, require('./lib')(md))

const m = require('markdownscript')
const reserved = require('reserved-words')

function plugin (markdown) {
const scope = { m }
Object.keys(m).filter(key => !reserved.check(key, 'next')).forEach(key => { scope[key] = m[key] })
return scope
module.exports.attributes = {
pkg: require('./package.json'),
}
16 changes: 1 addition & 15 deletions index.spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
'use strict'
const describe = require('mocha').describe
const it = require('mocha').it
const expect = require('chai').expect

const markdownscriptPlugin = require('.')

describe('mos-plugin-markdownscript', () => {
it('should extend markdown scope with markdownscript helpers', () => {
const scope = markdownscriptPlugin({})
expect(scope.m).to.be.a('function')
expect(scope.h1).to.be.a('function')
expect(scope.blockquote).to.be.a('function')
})
})
require('.')
11 changes: 11 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'
module.exports = plugin

const m = require('markdownscript')
const reserved = require('reserved-words')

function plugin (markdown) {
const scope = { m }
Object.keys(m).filter(key => !reserved.check(key, 'next')).forEach(key => { scope[key] = m[key] })
return scope
}
15 changes: 15 additions & 0 deletions lib/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict'
const describe = require('mocha').describe
const it = require('mocha').it
const expect = require('chai').expect

const markdownscriptPlugin = require('.')

describe('mos-plugin-markdownscript', () => {
it('should extend markdown scope with markdownscript helpers', () => {
const scope = markdownscriptPlugin({})
expect(scope.m).to.be.a('function')
expect(scope.h1).to.be.a('function')
expect(scope.blockquote).to.be.a('function')
})
})

0 comments on commit 3e1b391

Please sign in to comment.