Я использую PHP Markdown (версия 1.0.1n, обновлено в октябре 2009 г.) для отображения текста, сохраненного в базе данных, в формате уценки. Я сталкиваюсь со странной проблемой, когда он помечает последний кусок каждой записи как H3. Когда я ищу в файле markdown.php, нет ни одного экземпляра H3.
Вот две части текста из моей базы данных:
Since its launch, major CPG brands, endemic as well as non-endemic, have flocked to retail websites to reach consumers deep in the purchase funnel through shopping media. In this session, you will hear about:
- The prioritization of shopping media for CPG brands.
- A case study of brands on Target.com on how this retailer (and others) have introduced a new channel for brand marketers to engage consumers where they are making the majority of purchase decisions: online.
- How CPG brands are leveraging real-time data from shopping media to capture consumer insights and market trends.
В этом он правильно помечает элементы LI, но внутри последнего LI он помечает фактический текст как H3.
Beyond the actual money she saves, this consumer is both empowered and psychologically gratified by getting the best value on her everyday purchases. It is essential for both marketers and retailers to focus on what motivates and activates this consumer.
Diane Oshin will share insights on what influences her shopping behavior and then identify specific tools that activate her to buy.
В этом, весь абзац, начинающийся с Дайан Ошин, помечен как H3.
Вот действительно странная вещь: когда я делаю вид источника, они оба помечаются правильно; только при использовании Inspect Element я вижу H3. Тем не менее, на реальном дисплее очевидно, что применяется тег H3:
пример 1
пример 2
Кто-нибудь может мне помочь?
обновление
Согласно комментарию ниже, я искал экземпляры тегов H. Я нашел эти функции, но не знаю, может ли это быть причиной проблемы или нет. Это единственное место во всем файле, в котором создается тег заголовка любого типа.
function doHeaders($text) {
# Setext-style headers:
# Header 1
# ========
#
# Header 2
# --------
#
$text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
array(&$this, '_doHeaders_callback_setext'), $text);
# atx-style headers:
# # Header 1
# ## Header 2
# ## Header 2 with closing hashes ##
# ...
# ###### Header 6
#
$text = preg_replace_callback('{
^(\#{1,6}) # $1 = string of #\'s
[ ]*
(.+?) # $2 = Header text
[ ]*
\#* # optional closing #\'s (not counted)
\n+
}xm',
array(&$this, '_doHeaders_callback_atx'), $text);
return $text;
}
function _doHeaders_callback_setext($matches) {
# Terrible hack to check we haven't found an empty list item.
if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
return $matches[0];
$level = $matches[2]{0} == '=' ? 1 : 2;
$block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
return "\n" . $this->hashBlock($block) . "\n\n";
}
function _doHeaders_callback_atx($matches) {
$level = strlen($matches[1]);
$block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>";
return "\n" . $this->hashBlock($block) . "\n\n";
}