Closed bosborne closed 7 years ago
does $('.#content')
or $('.#page-content')
return elements?
Get errors in the debugger with those:
Exception with thrown value: Error: Syntax error, unrecognized expression: .#page-content
Exception with thrown value: Error: Syntax error, unrecognized expression: .#content
Should have added, this is on Mac OS, either Safari or Firefox.
jQuery can't throw error but at least returns an empty array, please check your environment because something is wrong unrelated to toc generator
The latest tocmd-generator code also does not work at GitHub, here's an example:
http://bioperl.github.io/howtos/Beginners.html
I tried #content, #main_content, and #page-content. No TOC, and also no errors. It should make a little TOC, there are some H1's and H2's in there. I'm thinking this has to do with parsing, can you take a look at the HTML and verify that the parsing should work? Thank you in advance.
The error is in your code, you are defined page-content
as class not id, try to replace the code with
$('.page-content').toc();
Using the code above I can see the TOC
This does not work, unfortunately:
<script type="text/javascript">
$('.page-content').toc({
showAlways:true
});
</script>
See http://bioperl.github.io/howtos/Beginners.html. It might have to do with the Markdown converters that make the HTML. I am using redcarpet, what are you using? When you say the code works for you I think you are talking about HTML that's different from mine, and I'm thinking all of this has to do with parsing.That's my current hypothesis anyway.
I've added a sample demo page https://github.com/dafi/tocmd-generator/commit/9e8b9d718dc125ccd3672b85a4fd89ecbd86cf39 Tell me if it helps you
This doesn't produce any text. No errors either. I also tried "#content" and "#page-content" (which is the id of the div that Jekyll uses, latest version). I also tried JQuery 2.1.4. Could you add a bit more to the example? Thank you in advance.