Skip to content

Commit

Permalink
Added support for nested styles in headers and links
Browse files Browse the repository at this point in the history
  • Loading branch information
xavi- authored and ashb committed Jun 19, 2011
1 parent 8915018 commit e748f00
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ Markdown.dialects.Gruber = {

if ( !m ) return undefined;

var header = [ "header", { level: m[ 1 ].length }, m[ 2 ] ];
var header = [ "header", { level: m[ 1 ].length } ];
Array.prototype.push.apply(header, this.processInline(m[ 2 ]));

if ( m[0].length < block.length )
next.unshift( mk_block( block.substr( m[0].length ), block.trailing, block.lineNumber + 2 ) );
Expand Down Expand Up @@ -832,7 +833,9 @@ Markdown.dialects.Gruber.inline = {
if ( m[4] !== undefined)
attrs.title = m[4];

return [ m[0].length, [ "link", attrs, m[1] ] ];
var link = [ "link", attrs ];
Array.prototype.push.apply( link, this.processInline( m[1] ) );
return [ m[0].length, link ];
}

// [Alt text][id]
Expand All @@ -844,19 +847,16 @@ Markdown.dialects.Gruber.inline = {
// [id] case, text == id
if ( m[2] === undefined || m[2] === "" ) m[2] = m[1];

attrs = { ref: m[ 2 ].toLowerCase(), original: m[ 0 ] };
link = [ "link_ref", attrs ];
Array.prototype.push.apply( link, this.processInline( m[1] ) );

// We can't check if the reference is known here as it likely wont be
// found till after. Check it in md tree->hmtl tree conversion.
// Store the original so that conversion can revert if the ref isn't found.
return [
m[ 0 ].length,
[
"link_ref",
{
ref: m[ 2 ].toLowerCase(),
original: m[ 0 ]
},
m[ 1 ]
]
link
];
}

Expand Down

0 comments on commit e748f00

Please sign in to comment.