mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-24 08:28:50 -05:00
Fixed issue where gists wouldn't get line numbers added. Fixed issue where backtick code blocks were getting empty figcaptions
This commit is contained in:
parent
608d9fb9bd
commit
64b2d2355d
@ -40,17 +40,17 @@ function addSidebarToggler() {
|
||||
|
||||
function addCodeLineNumbers() {
|
||||
if (navigator.appName === 'Microsoft Internet Explorer') { return; }
|
||||
$('div.gist-highlight').each(function(code) {
|
||||
$('div.gist-highlight').each(function(index) {
|
||||
var tableStart = '<table><tbody><tr><td class="gutter">',
|
||||
lineNumbers = '<pre class="line-numbers">',
|
||||
tableMiddle = '</pre></td><td class="code">',
|
||||
tableEnd = '</td></tr></tbody></table>',
|
||||
count = $('.line', code).length;
|
||||
count = $('.line', this).length;
|
||||
for (var i=1;i<=count; i++) {
|
||||
lineNumbers += '<span class="line-number">'+i+'</span>\n';
|
||||
}
|
||||
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd;
|
||||
$(code).html(table);
|
||||
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', this).html()+'</pre>' + tableEnd;
|
||||
$(this).html(table);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ module BacktickCodeBlock
|
||||
if markup =~ AllOptions
|
||||
highlight(code, $1, {caption: $2, url: $3, anchor: $4 || 'Link', linenos: linenos, start: start, marks: marks})
|
||||
elsif markup =~ LangCaption
|
||||
highlight(code, $1, {caption: $2 || '', linenos: linenos, start: start, marks: marks})
|
||||
highlight(code, $1, {caption: $2 || nil, linenos: linenos, start: start, marks: marks})
|
||||
else
|
||||
highlight(code, 'plain', {linenos: linenos, start: start})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user