Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Marp Core instance to functional engine #386

Merged
merged 3 commits into from
Aug 29, 2021

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Aug 29, 2021

Improved a functional engine to allow using built-in Marp Core instance by non enumerable marp getter. Importing Marp Core installed by user is no longer required for simple customization.

Example: markdown-it-mark

Previous version

// engine.js
const { Marp } = require('@marp-team/marp-core')
const markdownItMark = require('markdown-it-mark')

module.exports = (opts) => new Marp(opts).use(markdownItMark)
# Install Marp Core and markdown-it-mark
npm install @marp-team/marp-core markdown-it-mark --save-dev

# Specify the path to functional engine
marp --engine ./engine.js slide-deck.md

Current

// engine.js
module.exports = ({ marp }) => marp.use(require('markdown-it-mark'))
# Install markdown-it-mark
npm install markdown-it-mark --save-dev

# Specify the path to functional engine
marp --engine ./engine.js slide-deck.md

A previous way is still available and useful for full-customization.


In addition, importing Marp Core has put off until needed. It means making faster CLI startup (especially --help).

Improved a functional engine to allow using built-in Marp Core instance
by non enumerable `marp` getter. Importing Marp Core installed by user
is no longer required for simple customization.

In addition, importing Marp Core has put off until needed. It means
making faster CLI startup.
@yhatt yhatt changed the title Expose Marp to the argument of functional engine Expose Marp Core instance to the argument of functional engine Aug 29, 2021
@yhatt yhatt changed the title Expose Marp Core instance to the argument of functional engine Expose Marp Core instance to an argument of functional engine Aug 29, 2021
@yhatt yhatt changed the title Expose Marp Core instance to an argument of functional engine Expose Marp Core instance to functional engine Aug 29, 2021
@yhatt yhatt merged commit a013665 into main Aug 29, 2021
@yhatt yhatt deleted the expose-marp-to-functional-engine branch August 29, 2021 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant