• Hey! Thank you again for this fine TOC-plugin 🙂

    I’m struggling a little with validation of the unordered list, as it appears to output different number of li and /li tags.

    Sample post at
    https://oldrup.dk/simpletoc-troubleshooting/

    CodePen where I copied the HTML contained within the outer ul element:
    https://codepen.io/oldrup/pen/ZEPPqgm throws this error when it analyzes the HTML markup:

    Tag must be paired, missing: [ </li> ], start tag match failed [ <li> ] on line 2.

    My editor counts 8 li and 7 /li

    While browsers are forgiving and the TOC renders, it does throw errors in automated tests like in CodePen or Checkbot

    Please let me know if I can do anything to help troubleshoot.

    • This topic was modified 4 months, 3 weeks ago by Bjarne Oldrup. Reason: Edit: forum removes tags from title; great

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marc Toensing

    (@marcdk)

    Hi, thank you for mentioning this. There was a refactoring a few weeks ago https://wordpress.org/support/topic/broken-markup-tags-closing-for-headers-below-minimum/ by @harmoney himself of the nested lists. I currently don’t have time to look into this. Maybe he has some time to look into the code or this will take a while to fix without breaking other stuff.

    @oldrup

    Does the problem appear on this page, too? THis is a test page @harmoney kindly generated. This would help a lot. https://mts.demo.cshp.co/wp-org-broken-markup-tags-closing-for-headers-below-minimum/

    • This reply was modified 4 months, 3 weeks ago by Marc Toensing.

    My pull request addressed a specific situation where encountering headings beyond the configured min & max limits actually did break browser rendering by inserting excess close li tags. Unfortunately I didn’t have enough available time to fully resolve and balance the open & close li tags.

    Marc’s plugin uses existing libraries & plugins as a basis (see the credits on the plugin page). The component that actually renders the open & close li tags does so in complete isolation from one another. I fear that to really address the markup syntax validity will demand completely rewriting that component.

    One idea I had was to evaluate the content as it currently does but store the goal ToC in an ordered, hierarchical array rather than generating markup immediately. Then at the end, generate the full markup in one pass based on the array. It may even be possible to use the built in WordPress menu walker features for generation, which would be even more robust.

    I won’t have time in the foreseeable future to attempt such a rewrite but found Marc to be entirely open to community contribution PRs on the plugin’s github repo if you do.

    Thread Starter Bjarne Oldrup

    (@oldrup)

    Does the problem appear on this page, too? THis is a test page @harmoney kindly generated. This would help a lot. https://mts.demo.cshp.co/wp-org-broken-markup-tags-closing-for-headers-below-minimum/

    Yeah, unfortunately it appears to. Checked with checkbot.io, and got these errors:

    Line 724, Column 1, Tag must be paired, missing: [ </li> ], start tag match failed [ <li> ] on line 706.
    Line 728, Column 6, Tag must be paired, missing: [ </li></li></li> ], start tag match failed [ <li> ] on line 684.
    Line 782, Column 1, Tag must be paired, no start tag: [ </li> ]
    Line 810, Column 1, Tag must be paired, missing: [ </ul> ], start tag match failed [ <ul> ] on line 799.
    Line 866, Column 6, Tag must be paired, no start tag: [ </ul> ]

    I won’t have time in the foreseeable future to attempt such a rewrite but found Marc to be entirely open to community contribution PRs on the plugin’s github repo if you do.

    Completely understandable, and thank you for your contribution, it is appreciated. This minor flaw, does not break user experience or functionality. Luckily, a missing end tag and browsers be like 🤷‍♂️ – whatever.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.