How to display a code snippet

Hi, should the <Raw> tag work with the <Template> tag?

For example, this will display the words ‘blah blah blah’ but not the Template code:
<Raw>blah blah blah<Template name="section-posts" /></Raw>

Thanks.

Based on my understanding, I imagine it would pass the template tag directly to the browser as HTML and since it isn’t valid HTML, the browser wouldn’t display anything. Have you tried it to see what happens?

Actually, I just wanted to display a code snippet without it being processed.

Combining the Format and Raw tags does the trick:
<Format code><Raw><Template name="section-posts" /></Raw></Format>

Ah nice, that works. If you want to display a code snippet, you should also check out Prism.

1 Like