PHP标记将最后一块内容标记为h3

PHP标记将最后一块内容标记为h3,php,markdown,Php,Markdown,我正在使用(1.0.1n版,2009年10月更新)以降价格式显示保存到数据库中的文本。我遇到了一个奇怪的问题,它将每个条目的最后一块标记为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

我正在使用(1.0.1n版,2009年10月更新)以降价格式显示保存到数据库中的文本。我遇到了一个奇怪的问题,它将每个条目的最后一块标记为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.
在这一段中,以Diane Oshin开头的整个段落被标记为H3

这里有一件非常奇怪的事情:当我做一个视图源代码时,它们都被正确地标记;只有在使用Inspect元素时,我才能看到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";
    }
函数doHeaders($text){
#Setext样式标题:
#标题1
#     ========
#  
#标题2
#     --------
#
$text=preg_replace_回调(“{^(+?)[]*\n(=+|-+)[]*\n+}mx”,
数组(&$this,“\u doHeaders\u callback\u setext”),$text);
#atx样式标题:
##标题1
###标题2
###带有结束散列的标题2##
#   ...
#标题6
#
$text=preg\u replace\u回调('{
^(\\{1,6})\$1=一串\\'s
[ ]*
(.+?)#$2=标题文本
[ ]*
\#*#可选关闭#\(不计算在内)
\n+
}xm',
数组(&$this,“\u doHeaders\u callback\u atx”),$text);
返回$text;
}
函数_doHeaders_callback_setext($matches){
#我们没有找到一个空的列表项。
如果($matches[2]='-'&&preg_match('{^-(?:$)}',$matches[1]))
返回$matches[0];
$level=$matches[2]{0}='='='?1:2;
$block=”“.$this->runSpanGamut($matches[1])”;
返回“\n”。$this->hashBlock($block)。“\n\n”;
}
函数_doHeaders_callback_atx($matches){
$level=strlen($matches[1]);
$block=“”.$this->runSpanGamut($matches[2])”;
返回“\n”。$this->hashBlock($block)。“\n\n”;
}

我无法用您收到的版本重现您所描述的内容:

<?php
include(__DIR__.'/php-markdown/markdown.php');


$testText = '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.
';

$resultText = Markdown($testText);

var_dump($resultText);

我无法复制您所描述的版本:

<?php
include(__DIR__.'/php-markdown/markdown.php');


$testText = '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.
';

$resultText = Markdown($testText);

var_dump($resultText);


您是否尝试过获取项目的开发版本?您可以找到它。查找
H
的实例,因为
3
可能是根据解析器状态添加的。@hakre-我正在更新原始帖子;H标记很奇怪…我使用的是我发布的链接上的最新版本(版本1.0.1n,2009年10月更新)。@Blender-我刚刚克隆了git版本,然后运行了一个文件比较-git repo中的markdown.php文件与我当前拥有的文件相同。您尝试过获取项目的开发版本吗?您可以找到它。查找
H
的实例,因为
3
可能是根据解析器状态添加的。@hakre-我正在更新原始帖子;H标记很奇怪…我使用的是我发布的链接上可用的最新版本(版本1.0.1n,2009年10月更新)。@Blender-我刚刚克隆了git版本,然后运行了一个文件比较-git repo中的markdown.php文件与我当前拥有的文件相同。感谢您花时间这么做。我必须搜索我们的样式表,看看是否有什么原因导致了这种情况。我不知道你是否还在看这个,但我打电话给Markdown,只是直接打印了文本,没有奇怪的格式。所以它必须是降价函数中的某种东西在起作用,不是吗?不是在我的电脑上,它工作得很好。查看我发布的代码。好吧,我在我的应用程序中尝试了你的代码,当我进行var_dump时,我得到了如下信息:
Target.com上的一个品牌案例研究,介绍了这家零售商(和其他零售商)如何为品牌营销人员引入一个新渠道,让消费者参与他们做出的大部分购买决策:在线。CPG品牌如何利用来自购物媒体的实时数据捕捉消费者见解和市场趋势。字符串(1382)“
字符串(1382)不是内容的一部分,每个记录都有一个不同的数字。知道是什么原因吗?谢谢你花时间这么做。我必须搜索我们的样式表,看看是否有什么原因。我不知道你是否还在看这个,但我打电话给Markdown,只打印了纯文本,还有没有奇怪的格式。所以它一定是在降价函数中起作用的,不是吗?不是在我的计算机上,它工作得很好。请看我发布的代码。好的,我在我的应用程序中尝试了你的代码,当我进行var_转储时,我会得到这样的结果:
Target.com上的一个品牌案例研究,关于这个零售商(和其他零售商)是如何做的为品牌营销人员引入了一个新渠道,让他们在做出大部分购买决策的地方吸引消费者:在线。CPG品牌如何利用来自购物媒体的实时数据来捕捉消费者的见解和市场趋势。字符串(1382)“
字符串(1382)不是内容的一部分,每个记录都有不同的编号。知道是什么引起的吗?