mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Fixed #11 -- <style> tags are now not wrapped in <p>'s + test case for this
This commit is contained in:
parent
a3a07eaac6
commit
3e00e5a2d1
|
@ -215,8 +215,8 @@ var _HashHTMLBlocks = function(text) {
|
|||
// "paragraphs" that are wrapped in non-block-level tags, such as anchors,
|
||||
// phrase emphasis, and spans. The list of tags we're looking for is
|
||||
// hard-coded:
|
||||
var block_tags_a = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del"
|
||||
var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math"
|
||||
var block_tags_a = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style";
|
||||
var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style";
|
||||
|
||||
// First, look for nested blocks, e.g.:
|
||||
// <div>
|
||||
|
@ -265,7 +265,7 @@ var _HashHTMLBlocks = function(text) {
|
|||
) // attacklab: there are sentinel newlines at end of document
|
||||
/gm,function(){...}};
|
||||
*/
|
||||
text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement);
|
||||
text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement);
|
||||
|
||||
// Special case just for <hr />. It was easier to make a special case than
|
||||
// to make the other regex more complicated.
|
||||
|
|
6
test/cases/inline-style-tag.html
Normal file
6
test/cases/inline-style-tag.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
<style>
|
||||
p { line-height: 20px; }
|
||||
</style>
|
||||
|
||||
<p>An exciting sentence.</p>
|
6
test/cases/inline-style-tag.md
Normal file
6
test/cases/inline-style-tag.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
<style>
|
||||
p { line-height: 20px; }
|
||||
</style>
|
||||
|
||||
An exciting sentence.
|
Loading…
Reference in New Issue
Block a user