-
- 571 Posts
I am using Markdown Parser 1.0.0-beta1
https://modx.com/extras/package/markdownparser.
This is a Plugin that is triggered by
OnWebPagePrerender.
It converts any text it finds tagged between
<markdown></markdown> tags to HTML.
I am only going to be displaying text that has been written in Markdown on pages that use a specific template.
Is there any way of limiting a Plugin to a specific template id, or range of template id's?
discuss.answer
-
- 5,888 Posts
you would need to modify the plugin - code and need something like this in it:
$markdown_templates = array(1,2,3);
$template = $modx->resource->get('template');
if (in_array($template,$markdown_templates)){
//run the plugin
}
I prefer to use output-filters for manipulations like that, where I can manipulate specific fields within specific templates, just where needed.
-
- 571 Posts
Hello Bruno
Thank you for this. It works perfectly!
I agree about the output filters. I had hoped to use markdownOF 1.0.0-alpha1 as it would do a markdown conversion for me using just output filters where I place them.
But the markdownOF has a note saying:
This version is deprecated. It is recommended to use a newer version.
However I can't find a newer version.
https://modx.com/extras/package/markdownof
If anyone knows of an updated version of this, or of a similar extra that would be great.
-
- 5,888 Posts
-
- 571 Posts
Thanks Bruno.
I had just found this one
https://gist.github.com/christianhanvey/2965696 which seems to work well for my limited needs, but will also check out
https://github.com/bezumkin/modx-markdown