Commit dba73cf2 authored by Marcel Stör's avatar Marcel Stör
Browse files

Fix HTML anchors in ToC generator

parent b1dcb705
...@@ -38,7 +38,8 @@ var nodemcu = nodemcu || {}; ...@@ -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 || {}; ...@@ -220,4 +221,4 @@ var nodemcu = nodemcu || {};
} }
return values; return values;
} }
}()); }());
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment