I write all my posts in Markdown, using the PHP Markdown Extra plugin, so I added support to my version of Post Snippets 2.0. It would be nice if future versions of Post Snippets had this option, or had some facility to call other text formatting functions through some general mechanism.
To add Markdown support, I needed to call the global Markdown() function with the snippet in the right places:
- post-snippets.php:create_shortcodes(): created similar code for the wptexturize isset handling, and also in the add_shortcode() function call, first checking for the existence of the Markdown() function.
- settings.php:add(): added ‘markdownextra’ to the list of snippets
- settings.php:update(): added update for ‘markdownextra’ key, following the wptexturize as an example
- settings.php:tab_snippets(): checked for existing of ‘Markdown’ function, and if it exists add a checkbox for the settings page in similar fashion to the ‘wptexturize’ option
This appears to work. A more general approach might be to allow a text field in the settings panel to check for existence of an arbitrary class/function or global function name, and call that to do additional text formatting.
Just thought I’d share in case someone else was looking for something similar…thanks for creating this plugin and doing the hard work!
- The topic ‘[Plugin: Post Snippets] Markdown Extra Support’ is closed to new replies.