You are here

function _filter_markdown in Markdown 7.2

Same name and namespace in other branches
  1. 7 markdown.module \_filter_markdown()

Filter process callback.

1 string reference to '_filter_markdown'
markdown_filter_info in ./markdown.module
Implements hook_filter_info().

File

./markdown.module, line 140
Provides a Markdown input filter.

Code

function _filter_markdown($text, $format) {
  if (empty($text)) {
    return $text;
  }
  if (($library = libraries_load('markdown')) && !empty($library['loaded'])) {
    $text = Michelf\MarkdownExtra::defaultTransform($text);
  }
  else {
    $href = url(drupal_get_path('module', 'markdown') . '/README.txt');
    drupal_set_message(t('Missing Markdown library. Read installation section in <a href="@href">README.txt</a> file.', array(
      '@href' => $href,
    )), 'error', FALSE);
  }
  return $text;
}