The combination of filters and macros in the editor can create a powerful environment for creating dynamic page content in the editor.
Dynamic content is where a script, templating engine, or process evaluates a variable or declared function contained within a HTML document.
An example of such a dynamic page fragment might be:
<html> <body> <p> The date today is: [[date]] </p> </body> </html>
Where [[date]]
is evaluated at render-time by some outside process, for example.
Often, it is difficult to portray such dynamic content in a WYSIWYG editing environment, without taking away the dynamic behavior itself.
Using macros, you can replace content in real-time, whilst preserving original state by wrapping original values in data-
attributes.
The demo below shows an example where we can show true WYSIWYG output of dynamic functions, such as [[date]]
, but use the original function when editor.content.get()
is called: