Fix HTML anchors in ToC generator
This commit is contained in:
parent
b1dcb70593
commit
dba73cf214
|
@ -38,7 +38,8 @@ var nodemcu = nodemcu || {};
|
||||||
}
|
}
|
||||||
function createTocTableRow(func, intro) {
|
function createTocTableRow(func, intro) {
|
||||||
// fragile attempt to auto-create the in-page anchor
|
// fragile attempt to auto-create the in-page anchor
|
||||||
var href = func.replace(/\.|:/g, '').replace('()', '').replace(' --', '-').replace(/ /g, '-');
|
// good tests: file.md,
|
||||||
|
var href = func.replace(/[\.:\(\)]/g, '').replace(/ --|, | /g, '-');
|
||||||
var link = '<a href="#' + href.toLowerCase() + '">' + func + '</a>';
|
var link = '<a href="#' + href.toLowerCase() + '">' + func + '</a>';
|
||||||
return '<tr><td>' + link + '</td><td>' + intro + '</td></tr>';
|
return '<tr><td>' + link + '</td><td>' + intro + '</td></tr>';
|
||||||
}
|
}
|
||||||
|
@ -220,4 +221,4 @@ var nodemcu = nodemcu || {};
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in New Issue