Home / GitHub Page

Where to put custom markdown-it plugin?

I’m currently working on a markdown-it plugin to extract text from markdown, and I was wondering where the rules for the plugin should be defined, since it’s not really going to be used for Joplin’s renderer, but for a specific function. Since it’s a one-off usecase, can it be defined in the function itself? Or is there a different convention to be followed? Thanks.

What would the plugin do exactly?

The plugin is for extracting text from markdown, as part of this PR. The current solution for removing markdown, as we discussed, is based on regex and therefore not very reliable. I had previously written a regex-based implementation in markdownUtils.js, which this plugin is meant to replace.

@laurent any update on this? I’m almost done with the plugin. Since it’s actually part of work on another PR, I don’t know if you would want it as a separate one. If you prefer to stay with the current stripMarkdown implementation, that’s fine by me and I will use that for my needs

Is there a need for a plugin in this case? Sounds like markdownUtils.stripMarkdown would do what you need?

As I mentioned earlier, you yourself had mentioned that a markdown it parser based approach would be better than a regex based one which the current package uses. I have been away from development for almost 3 weeks, so I’m not aware of the performance of the current package. If there are no issues, I can go ahead using it. Else, I can implement the same function with the markdown-it plugin