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:'. 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;
}