1
0
Fork 0

[#5] Added sub/sup support for vars in documentation

closure/master
Mike Gerwitz 2011-11-08 22:51:04 -05:00
parent 6452a239f3
commit 5999223c4e
2 changed files with 34 additions and 0 deletions

View File

@ -49,6 +49,19 @@ jqueryCheck( function()
{ {
hljs.highlightBlock( element, ' ' ); hljs.highlightBlock( element, ' ' );
} ); } );
// quick-n-dirty sub and super script impl (it is by no means perfect)
$( 'var:contains("\\")' ).each( function()
{
var $this = $( this );
$this.html(
$this.html().replace( /(\\.*)$/, '<div>$1</div>' )
.replace( /\\_([^ \\]+)/, '<sub>$1</sub>' )
.replace( /\\\^([^ \\]+)/, '<sup>$1</sup>' )
.replace( /(<\/su[bp]><su[bp])>/, '$1 class="left">' )
);
} );
} ); } );
} ); } );

View File

@ -43,6 +43,27 @@ var {
font-family: monospace; font-family: monospace;
} }
var div {
position: relative;
display: inline;
}
var sub, var sup {
font-size: 0.75em;
}
sup.left {
position: absolute;
left: 0px;
top: -0.75em;
}
sub.left {
position: absolute;
left: 0px;
bottom: -0.2em;
}
.float { .float {
border: 1px solid #babdb6; border: 1px solid #babdb6;
padding: 0px; padding: 0px;