File tree 2 files changed +92
-79
lines changed
2 files changed +92
-79
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,18 @@ function highlight (description) {
55
55
let element = $ ( el )
56
56
let klass = element . attr ( 'class' )
57
57
let lang = ''
58
+ let tableHeader = ''
58
59
if ( klass ) {
59
- lang = determineLanguage ( klass . split ( '-' ) . pop ( ) )
60
+ let type = klass . split ( '-' ) . pop ( )
61
+ if ( isFile ( type ) ) {
62
+ tableHeader = `
63
+ <thead>
64
+ <tr>
65
+ <td colspan="2">${ type } </td>
66
+ </tr>
67
+ </thead>`
68
+ }
69
+ lang = determineLanguage ( type )
60
70
}
61
71
let lines = element . html ( ) . split ( '\n' )
62
72
@@ -71,7 +81,7 @@ function highlight (description) {
71
81
element . parent ( ) . after ( `<div class="highlight ${ lang } ">
72
82
<div class="ribbon"></div>
73
83
<div class="scroller">
74
- <table class="CodeRay">
84
+ <table class="CodeRay">${ tableHeader }
75
85
<tbody>
76
86
<tr>
77
87
<td class="line-numbers"><pre>${ lineNumbers } </pre></td>
@@ -102,3 +112,7 @@ function determineLanguage (lang) {
102
112
function removeHLJSPrefix ( string ) {
103
113
return string . replace ( / h l j s - / g, '' )
104
114
}
115
+
116
+ function isFile ( string ) {
117
+ return / \. / . test ( string )
118
+ }
You can’t perform that action at this time.
0 commit comments