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

How to handle plugin options? #23

Open
SaulSilver opened this issue Dec 13, 2023 · 0 comments
Open

How to handle plugin options? #23

SaulSilver opened this issue Dec 13, 2023 · 0 comments

Comments

@SaulSilver
Copy link

Thank you for the nice package. This isn't an issue, but didn't where else to post it. I wanted to share with those who wanted to do the same as I did and save their time.

I wanted to extend @AlextheYounga implementation of allowing plugins to also handle the plugins' options (not to confuse with markdown-it options).

For me, I wanted to add an option to the markdown-it-anchor that I pass as a plugin to vue-markdown-renderer, and override the default slugify function. So I did the following in the :

<script>
const customSlugify = ...;

const anchorPlugin = (vueMarkdownItInstance: MarkdownIt) => {
  vueMarkdownItInstance.use(MarkdownItAnchor, {
    slugify: customSlugify
  });
};

const plugins = [anchorPlugin, /* other plugins */];
<script>

And then I just pass the plugins to vue-markdown-renderer in the tag as you normally would do.

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

No branches or pull requests

1 participant