Repository navigation
Include HTML defined headings in TOC - #41
deberlhe-jb wants to merge 5 commits into
Conversation
|
Just an FYI I'll be working on a load of Kiln stuff next week so will review all the open PRs then |
|
Hi @0xTim, I know you're busy, just checking if there's any chance this could be reviewed/merged this month ? |
0xTim
left a comment
There was a problem hiding this comment.
Thanks for this. There are three main issues I think we need to fix:
- attributes are allowed to be unquoted (providing no spaces), single quoted, or double quoted. We only look for double quotes in this PR, losing attributes, which would include IDs that are valid
- Unclosed tags run across newlines, which will cause problems downstream. This isn't too much of an issue for most things, as the HTML will be invalid, but will be a problem with comments
- The comment about losing inner HTML that affects not only the ToC (where it would be valid to strip) but also the page HTML which is a problem
| </section> | ||
| </section> | ||
| <section> | ||
| <h2>Another <strong>big</strong> section</h3> |
There was a problem hiding this comment.
We're losing HTML information here are we not? This isn't in the ToC, this is in the page code which would be a regression
There was a problem hiding this comment.
Thanks for the detailed feedback!
You're right, I did not have unquoted or single-quoted attributes in mind.
I'll rework these three topics and let you know when I'm done.
There was a problem hiding this comment.
Alright, I pushed fixes for the different attribute syntax and for the loss of page HTML in headers.
I'm failing to see where unclosed tags like comments would cause issues though, as this code would not be called for tags that are not header ones.
Removal of HTML tags from the ToC entries would also remove comments, but this seems fine to me as I believe comments should be for developers rather than end-users.
|
@0xTim this merge request is ready for review as well |
The table of contents was generated from headings defined in MarkDown syntax.
Markdown allows HTML blocks, but these where just added as is in the output, ignoring headers it might have in it.
This finds headings from HTML blocks and generates the TOC entries with the following rules :
Unit test added to cover this new behavior.