我对 Perl 一无所知,但我真的只需要对 Markdown 语法做一点小小的改动。所以我很抱歉我问了一个非常基本的问题。
我想创建一个定制的降价来做到这一点
<div class="note">
<b>My note title</b>
My note texts
</div>
我发现这个很棒的帖子可以div
用笔记类创建,语法如下:
~? This is a Note Block ~?
~! This is a Warning Block ~!
但是,我希望能够通过将标题括在某个符号中来指定注释的标题。如下所示:
~? #Title#
This is a Note Block ~?
以下是帖子中的Perl 自定义类
sub _DoNotesAndWarnings {
my $text = shift;
$text =~ s{
\n~([\!\?]) # $1 = style class
(.+?) # $2 = Block text
~[\!\?] # closing syntax
}{
my $style = ($1 eq '!') ? "Warning" : "Note";
"<div class=\"$style\">" . _RunSpanGamut("<b>$style:</b> \n" . $2) . "</div>\n\n";
}egsx;
return $text;
}
我应该如何修改这段代码?非常感谢您的帮助!