Selvin Ortiz

Shortcodes

Doxter allows you to use shortcode syntax within the Doxter Field or in source markdown passed to the doxter() filter.

This gives you tremendous flexibility because you can let Doxter do its thing and when you need custom output, shortcodes will be there at your disposal.

What are shortcodes? #

A shortcode is a specific parsing rule that lets you do nifty things with very little effort. Shortcodes can embed video and images or create output that would normally require lots of complicated, ugly code in just one line.

In the following example, we will implement a shortcode that ships with Doxter — image shortcode — from scratch.

Image Shortcode #

This shortcode creates a fluid image from a plain image source URL or from an asset.

<!-- shortcode -->
[image src="/path/to/img.jpg" alt="My Image" class="fluid"]

<!-- output -->
<p><img src="/path/to/img.jpg" alt="My Image" class="fluid" /></p>

Ok, we saved a couple of key strokes at best in this example… surely shortcodes can do more than that, right?!