Extra format options (either php format or coaster presets coaster.short/coaster.long)
@param string $content
@param array $options
@return string
339861
public function display($content, $options = [])
    {
        if (!empty($options['format'])) {
            if (strpos($options['format'], 'coaster.') === 0) {
                $options['format'] = config('coaster:date.format'.substr($options['format'], 8));
            }
            $content = (new Carbon($content))->format($options['format']);
        }
        return parent::display($content, $options);
    }
281819
public function lead($content, $options = [])
    {
        $options = array_merge(['class' => 'lead'], $options);
        return parent::tag('p', $content, $options);
    }
526417
public static function badge($content, $options = [])
    {
        static::addCssClass($options, 'badge');
        $color = ArrayHelper::remove($options, 'color');
        if (!empty($color)) {
            static::addCssClass($options, $color);
        }
        return static::tag(ArrayHelper::remove($options, 'tag', 'span'), $content, $options);
    }
1304193
public function table($content, $options = array())
    {
        if ('text' == $this->getType()) {
            return $content;
        }

        if (false === $options) {
            return $this->config('templates.tableend');
        }

        $tag = 'table';
        if (is_null($content)) {
            $tag = 'tablestart';
        }

        $templater = $this->templater();
        return $templater->format('table', [
        'attrs' => $templater->formatAttributes($this->_mergeAttributes($options, $this->config('attributes.table'))),
        'content' => $content
        ]);
    }
824612
public function save($content)
    {
        $path = $this->buildPath();

        $this->createDir($path);
        file_put_contents($path, $content);

        if (!$this->extension) {
            $this->extension = $this->determineExtension($content);
        }

        if ($this->extension) {
            rename($path, $path . '.' . $this->extension);
            $path .= '.' . $this->extension;
        }

        return $path;
    }
1070130
public function renderOutput($content, array $options)
    {
        $options = $this->transformOptions($options);
        $pdfGenerator = $this->createPdfGenerator();

        return $pdfGenerator->renderOutputFromHtml($content, $options);
    }
1024232
public static function encodeShortcode($content)
    {
        $content = self::entitiesToUnicode($content);
        $content = self::unicodeToShortcode($content);

        return $content;
    }
410773
protected function renderTinymceWidget($content, array $options = [])
    {
        $height = isset($options['height']) ? intval($options['height']) : 0;
        if (0 >= $height) {
            $height = 250;
        }
        return $this->renderBlock('show_widget_tinymce', [
            'height' => $height,
            'route' => $content
        ]);
    }
806412
private function detectFormatByContent($content)
    {
        if (preg_match('/^\\{.*\\}$/is', $content)) {
            return self::FORMAT_JSON;
        }
        if (preg_match('/^([^=&])+=[^=&]+(&[^=&]+=[^=&]+)*$/', $content)) {
            return self::FORMAT_URLENCODED;
        }
        if (preg_match('/^<.*>$/s', $content)) {
            return self::FORMAT_XML;
        }
    }
153088
protected function shortenColors($content)
    {
        $content = preg_replace('/(?<=[: ])#([0-9a-z])\\1([0-9a-z])\\2([0-9a-z])\\3(?:([0-9a-z])\\4)?(?=[; }])/i', '#$1$2$3$4', $content);

        // remove alpha channel if it's pointless...
        $content = preg_replace('/(?<=[: ])#([0-9a-z]{6})ff?(?=[; }])/i', '#$1', $content);
        $content = preg_replace('/(?<=[: ])#([0-9a-z]{3})f?(?=[; }])/i', '#$1', $content);

        $colors = array(
            // we can shorten some even more by replacing them with their color name
            '#F0FFFF' => 'azure',
            '#F5F5DC' => 'beige',
            '#A52A2A' => 'brown',
            '#FF7F50' => 'coral',
            '#FFD700' => 'gold',
            '#808080' => 'gray',
            '#008000' => 'green',
            '#4B0082' => 'indigo',
            '#FFFFF0' => 'ivory',
            '#F0E68C' => 'khaki',
            '#FAF0E6' => 'linen',
            '#800000' => 'maroon',
            '#000080' => 'navy',
            '#808000' => 'olive',
            '#CD853F' => 'peru',
            '#FFC0CB' => 'pink',
            '#DDA0DD' => 'plum',
            '#800080' => 'purple',
            '#F00' => 'red',
            '#FA8072' => 'salmon',
            '#A0522D' => 'sienna',
            '#C0C0C0' => 'silver',
            '#FFFAFA' => 'snow',
            '#D2B48C' => 'tan',
            '#FF6347' => 'tomato',
            '#EE82EE' => 'violet',
            '#F5DEB3' => 'wheat',
            // or the other way around
            'WHITE' => '#fff',
            'BLACK' => '#000',
        );

        return preg_replace_callback(
            '/(?<=[: ])('.implode(array_keys($colors), '|').')(?=[; }])/i',
            function ($match) use ($colors) {
                return $colors[strtoupper($match[0])];
            },
            $content
        );
    }
267426
protected function renderTextareaWidget($content, array $options = [])
    {
        $options = array_replace([
            'html' => false,
        ], $options);

        return $this->renderBlock('show_widget_textarea', [
            'content' => $content,
            'options' => $options,
        ]);
    }
600850
public function transform($content, $options = [])
    {
        if (!$content) {
            return $content;
        }

        return self::TRANSFORM_PREFIX . md5((string) $content);
    }
1107319
public function display($content, $options = [])
    {
        $content = parent::display($content, $options);
        if (!empty($options['source'])) {
            return $content;
        }
        if (isset($options['meta']) &&  !isset($options['nl2br'])) {
            $options['nl2br'] = $options['meta'];
        }
        if ((isset($options['nl2br']) && $options['nl2br']) || !isset($options['nl2br'])) {
            $content = nl2br($content);
        }
        if (!empty($options['length'])) {
            $options['keep_tags'] = empty($options['keep_tags']) ? '' : $options['keep_tags']; //ie <br>,<p>
            $content = StringHelper::cutString(strip_tags($content, $options['keep_tags']), $options['length']);
            if ($options['keep_tags'] && $content) {
                $dom = new DOMDocument; // fix unclosed html tags
                $dom->loadHTML($content);
                $content = $dom->saveBodyHTML();
            }
        }
        return $content;
    }
1034487
protected function padContent($content)
    {
        if (strlen($this->char) > 0) {
            $length = $this->getLength();
            $padding_length = ceil($length / mb_strlen($this->char));

            $padding = str_repeat($this->char, $padding_length);
            $content .= mb_substr($padding, 0, $length - mb_strlen($content));
        }

        return $content;
    }
1365430
public function tableCell($content, array $options = [])
    {
        return $this->formatTemplate('tablecell', [
            'attrs' => $this->templater()->formatAttributes($options),
            'content' => $content
        ]);
    }
1155412
public function transform($content, $options = [])
    {
        if (!$content instanceof \DateInterval) {
            return 0;
        }

        $decTime = 0;
        $decTime += ($content->d ? $content->d * 60 * 24 : 0);
        $decTime += ($content->h ? $content->h * 60 : 0);
        $decTime += $content->i;
        $decTime += ($content->s ? $content->s / 60 : 0);

        return $decTime;
    }
36515
public function toJson($content, $options = [])
    {
        $options = $options + ['random' => false, 'repeated_view' => true];
        $options['repeater_id'] = $content;
        $repeaterRows = PageBlockRepeaterData::loadRepeaterData($content, $options['version'], $options['random']);
        $data = ['rows' => [], 'repeater_id' => $content];

        foreach ($repeaterRows as $rowId => $rowBlockData) {
            $data['rows'][$rowId] = [];

            foreach ($rowBlockData as $key => $rowContent) {
                $block = Block::preload($key);
                if ($block->exists) {
                    $data['rows'][$rowId] += json_decode($block->getTypeObject()->toJson($rowContent, $options), true);
                }
            }
        }

        return parent::toJson($data, $options);
    }