diff -ur markdown.orig/markdown.php markdown.new/markdown.php
--- markdown.orig/markdown.php 2007-09-26 14:41:22.000000000 -0400
+++ markdown.new/markdown.php 2007-12-04 22:41:10.000000000 -0500
@@ -34,6 +34,12 @@
@define( 'MARKDOWN_FN_LINK_CLASS', "" );
@define( 'MARKDOWN_FN_BACKLINK_CLASS', "" );
+# Highest level of header to generate
+@define( 'MARKDOWN_HEADER_BASE', 1 );
+
+# By default, footnote references for which no footnote is found will be left alone.
+# If this is turned on, they're removed from the output instead.
+@define( 'MARKDOWN_STRIP_UNRESOLVED_FNS', false );
#
# WordPress settings:
@@ -879,12 +884,12 @@
return $text;
}
function _doHeaders_callback_setext($matches) {
- $level = $matches[2]{0} == '=' ? 1 : 2;
+ $level = $matches[2]{0} == '=' ? MARKDOWN_HEADER_BASE : MARKDOWN_HEADER_BASE+1;
$block = "".$this->runSpanGamut($matches[1])."";
return "\n" . $this->hashBlock($block) . "\n\n";
}
function _doHeaders_callback_atx($matches) {
- $level = strlen($matches[1]);
+ $level = min(strlen($matches[1]) + MARKDOWN_HEADER_BASE - 1, 6);
$block = "".$this->runSpanGamut($matches[2])."";
return "\n" . $this->hashBlock($block) . "\n\n";
}
@@ -1987,13 +1991,13 @@
return " id=\"$attr\"";
}
function _doHeaders_callback_setext($matches) {
- $level = $matches[3]{0} == '=' ? 1 : 2;
+ $level = $matches[3]{0} == '=' ? MARKDOWN_HEADER_BASE : MARKDOWN_HEADER_BASE+1;
$attr = $this->_doHeaders_attr($id =& $matches[2]);
$block = "".$this->runSpanGamut($matches[1])."";
return "\n" . $this->hashBlock($block) . "\n\n";
}
function _doHeaders_callback_atx($matches) {
- $level = strlen($matches[1]);
+ $level = min(strlen($matches[1]) + MARKDOWN_HEADER_BASE - 1, 6);
$attr = $this->_doHeaders_attr($id =& $matches[3]);
$block = "".$this->runSpanGamut($matches[2])."";
return "\n" . $this->hashBlock($block) . "\n\n";
@@ -2481,7 +2485,9 @@
"".
"$num".
"";
- }
+ } elseif(MARKDOWN_STRIP_UNRESOLVED_FNS) {
+ return "";
+ }
return "[^".$matches[1]."]";
}