Skip to content
hertsch edited this page Apr 14, 2014 · 2 revisions

Markdown is an easy to use Markup Language, which is more and more used for the data exchange - this GitHub Wiki is also written in Markdown.

The TemplateTools Markdown Service provide you with two functions:

The Markdown Service support both, the standard Markdown Syntax and the Markdown Extra Syntax (enabled by default).

###html()

Parameter

  • string $text - Markdown formatted text (input)
  • boolean $extra - optional, default = true
  • boolean $prompt - optional, default = true (php only)

Usage php

<?php $template['markdown']->html('This is a **Markdown** text.'); ?>

Usage twig (as Filter)

{{ 'This is a **Markdown** text.'|markdown }}

or Usage twig (as Function)

{{ markdown('This is a **Markdown** text.') }}

This will output the following HTML code:

<p>This is a <strong>Markdown</strong> text.</p>

###file()

Parameter

  • string $path - full path to a Markdown formatted file
  • boolean $extra - optional, default = true
  • boolean $prompt - optional, default = true (php only)

Usage php

<?php $template['markdown']->file(MANUFAKTUR_PATH.'/TemplateTools/README.md'); ?>

Usage twig

{{ markdown_file(MANUFAKTUR_PATH ~ '/TemplateTools/README.md') }}

This will output the README.md file of the TemplateTools HTML formatted.

Markdown Service | Tools Service