Search code examples
javascriptnode.jsmarkdownshortcodedocpad

DocPad: How do I prevent clashing of render-plugins?


I'm writing my first plugin for DocPad and I'm really enjoying the process because it's actually pretty intuitive.

My plugin uses shortcode-parser to parse shortcodes in my markdown-documents.

Here's my problem:

The marked-plugin for DocPad converts " to ", which is totally expected behaviour. However, this breaks my plugin because what was [tagname attribute="some value"] becomes [tagname attribute="some value"].

Possible Solution:

There is already a plugin out there that handles shortcodes. It circumvents this problem by using a file-extension. The reason I wrote my own plugin was (aside from learning DocPad) that I don't want to have to add file extensions to hundreds of documents just to enable my plugin.

Are there any clean alternative besides using file-extensions to prevent render-plugins from clashing? If there was, for example, a configuration-attribute to specify the order in which render-plugins execute – I would consider that a pretty good solution.


Solution

  • I just went with using extensions. The resulting plugin can be found here, if anybody's interested: https://github.com/maximilianschmitt/docpad-plugin-shortcodeparser

    If anybody has a better idea to solve this kind of issue, please let me know!