contents
contents copied to clipboard
Not unique Ids and ids with spaces?
Hi,
I think i'm facing some bug with your library i'm using 4.0.2 version and all ids are like
#Wath is some think id
any ideas?
Please produce an example of expected vs actual result.
Well this is my code
// Use Contents library to create dynamically the table of contents
let $articleContainer = $('#table-contents-content');
let $tableContentsContainer = $('#table-contents-container');
let contents = $articleContainer.find('h2,h3').get();
// Append list to table contents
$tableContentsContainer.append(Contents({articles: contents}).list());
This is an example of h2:
<h2>How much weight can I lose</h2>
And this is the link auto generated by library: <a href="#How much weight can I lose"...
I expected something like that:
<a href="#how-much-weight-can-i-lose"...
And if I introduce two h2 tag with the same name the same name is generated as id and in the docs says the ids will be different with numbers.
#how-much-weight-can-i-lose #how-much-weight-can-i-lose1 #how-much-weight-can-i-lose2 ...
I'm doing something wrong?
Thanks
Looks like a bug.
It is a not a library that I use actively.
But if you patch it up, I am happy to merge a fix.
Yes, it's a bug. I will try to patch it up.
I fixed the bug please check the pull request.
#28