File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 13
13
ga ( 'send' , 'pageview' ) ;
14
14
</ script >
15
15
< script >
16
+ // This snippet fixes a bug caused by Github's pages-gem using kramdown v1.11.1.
17
+ // In order for anchor links to point to the correct place in the glossary, they must have an id
18
+ // This snippet ensures every definition term has an id
19
+ // See https://github.com/swcarpentry/styles/pull/129
16
20
$ ( 'dt' ) . each ( function ( ) {
17
21
if ( ! this . id ) {
18
22
var id = $ ( this ) . text ( ) ;
23
+ // If there's a ( in the name (e.g., "comma-separated values (CSV)") - just take everything up to the first (
19
24
var index = id . indexOf ( '(' ) ;
20
25
if ( index > 0 ) {
21
26
id = id . substring ( 0 , index ) ;
22
27
}
28
+ // Strip leading and trailing whitespace, convert spaces to dashes and convert everything to lowercase
23
29
id = id . trim ( ) . replace ( / / g, '-' ) . toLowerCase ( ) ;
24
30
this . id = id ;
25
31
}
26
32
} ) ;
27
- </ script >
33
+ </ script >
You can’t perform that action at this time.
0 commit comments