Best way to render Meteor Template from within an editor


I have worked with frameworks in the past where a user could pass a specially handled tag within the editor that would tell a renderer to process a template from within the html that is passed through the editor.

For example in Mura cms , within the ckeditor if you add

[mura] mura.content() [/mura]

The system would actually process this code rather than adding the context to the page.
Is there a way to do this in Meteor. such as,

[meteor]{{> someTemplate}}}

{{> someTemplate}}

There is no direct way of doing it within spacebars but Blaze has an api to get the non-reactive string representation of a rendered template, it is called Blaze.toHTML(WithData)

You could create a custom helper or a block helper that takes in a template name and produces html output. You should of course provide a data context if that’s also necessary for the template to render properly.

Again, don’t forget that it won’t be reactive.

Thank you ,

This was a great point in the right direction, however I’m looking to render just the data within the template not neccesarily the whole template itself.
I want to pick out a template that is passed within the string and have blaze render than the return the entire block to the dom. So this would be an example :

<template name="one">
Hello World

In an editor such as froala.

Greetings from {{> one}}

Then on the browser

Greeting from Hello World.

I want to be able to render the template passed through the editor on the site. Doing this would allow my client a little more control over the site as I give them access to a few templates that I will create for them.

That’s not directly possible. What you need to do is create a custm tag for them and parse the document for that tag before displaying it and include the output from Blaze.toHTML instead of that tag.