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

Simplify Marpit plugins by using injected instance into markdown-it instance #147

Merged
merged 10 commits into from
Apr 2, 2019

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Apr 2, 2019

Now, Marpit plugins require injected marpit member into markdown-it instance. We've updated plugins to use injected instance for reading Marpit options.

We think that rarely happen this case, but you won't have to care params when use Marpit plugins individually. Just inject Marpit instance to marpit member.

const markdownit = new MarkdownIt()
markdownit.marpit = new Marpit()
markdownit.use(marpitSlide)

If you were using marpit.markdownItPlugins interface, marpit.markdown and markdownit.marpit would be updated to the last injected markdown-it/Marpit instance.

const marpit = new Marpit()
const markdownit = new MarkdownIt().use(marpit.markdownItPlugins)
// (marpit === markdownit.marpit && markdownit === marpit.markdown) === true

The purpose of this change is to prepare building an escape hatch of deprecated options. By injecting opinionated feature by individual plugins instead of controlling plugin's feature by Marpit options, the power user may build custom Marpit from a plain markdown-it instance with just picking favorite plugins. However, there is not a desire like that at this moment, so we won't work splitting plugins actively now.

@yhatt yhatt changed the title Simplify Marpit plugins to use injected instance to markdown-it instance Simplify Marpit plugins to use injected instance into markdown-it instance Apr 2, 2019
@yhatt yhatt changed the title Simplify Marpit plugins to use injected instance into markdown-it instance Simplify Marpit plugins by using injected instance into markdown-it instance Apr 2, 2019
@yhatt yhatt merged commit 8767170 into master Apr 2, 2019
@yhatt yhatt deleted the simplify-marpit-plugins branch April 2, 2019 06:26
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