The Markdown filter allows you to enter content using Markdown, a simple plain-text syntax that is transformed into valid XHTML.

'); break; } } function markdown_filter_info() { $filters['filter_markdown'] = array( 'title' => t('Markdown'), 'description' => t('Allows content to be submitted using Markdown, a simple plain-text syntax that is filtered into valid XHTML.'), 'process callback' => '_filter_markdown', 'settings callback' => '_filter_markdown_settings', 'tips callback' => '_filter_markdown_tips' ); return $filters; } function _filter_markdown_tips($format, $long = FALSE) { if ($long) { return t('Quick Tips:For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.'); } else { return t('You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.', array('@filter_tips' => url('filter/tips'), '@markdown_extra' => 'http://michelf.com/projects/php-markdown/extra/')); } } /** * Implements hook_block_view(). */ function markdown_block_view($delta = '') { $block = array(); switch ($delta) { case 'markdown_help': $block['title'] = t('Markdown filter tips'); $block['content'] = _markdown_help_block(); break; } return $block; } /** * Implements hook_block_info(). */ function markdown_block_info() { $blocks = array(); $blocks['markdown_help'] = array( 'info' => t('Markdown filter tips'), ); return $blocks; } // == Internal functions ======================================================= /** * Provides content for the markdown help block. */ function _markdown_help_block(){ return '
'. t("
## Header 2 ##
### Header 3 ###
#### Header 4 ####
##### Header 5 #####
(Hashes on right are optional)

Link [Drupal](http://drupal.org)

Inline markup like _italics_,
 **bold**, and `code()`.

> Blockquote. Like email replies
>> And, they can be nested

* Bullet lists are easy too
- Another one
+ Another one

1. A numbered list
2. Which is numbered
3. With periods and a space

And now some code:
    // Code is indented text
    is_easy() to_remember();") .'
'; } /** * Filter process callback. */ function _filter_markdown($text, $format) { if (!empty($text)) { include_once drupal_get_path('module', 'markdown') .'/markdown.php'; $text = Markdown($text); } return $text; } /** * Filter settings callback. Just provides a version overview. */ function _filter_markdown_settings($form, &$form_state, $filter, $format, $defaults) { include_once drupal_get_path('module', 'markdown') .'/markdown.php'; $settings['markdown_wrapper'] = array( '#type' => 'fieldset', '#title' => t('Markdown'), ); $links = array( 'Markdown PHP Version: '. MARKDOWN_VERSION .'', 'Markdown Extra Version: '. MARKDOWNEXTRA_VERSION .'', ); $settings['markdown_wrapper']['markdown_status'] = array( '#title' => t('Versions'), '#type' => 'item', '#markup' => theme('item_list', array('items' => $links)), ); return $settings; }