-
-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skip contents in <pre></pre> #38
Comments
Thanks for reporting this and yes it's possible to fix this. BTW a related issue exists. |
Table of Contents generated with DocToc Header 1Header 2False Heading 1 ------------------------ some text Failed Heading 2 ================================================ Yet another text |
Thanks for the link and a quick response, above post is a simple test and the generated TOC by doctoc |
Thanks for the test case. That is if you are interested to take this on and have the time. Otherwise I'll look into it once I have some bandwidth. |
I would love to help, however, I have no idea as well knowledge of your project. My main field is embedded system. Your project is extremely helpful and useful. bravo :) |
Both of these tests should be fixed before we can consider thlorenz#37, thlorenz#38, and thlorenz#88 as resolved. Credit goes to @yomed for `test/fixtures/readme-with-code.md`.
Fixes thlorenz#37, thlorenz#38, thlorenz#88. This commit builds upon the markdown-to-ast integration we added in thlorenz#91, using markdown-to-ast in `lib/get-html-headers.js`. We first filter our lines to only look for HTML sections (using the markdown parser), then in these HTML-only sections, we search for headers, as long as they're not inside pre tags. This is accomplished by keeping a stack of tags we've descended through. We can peek at the top of the stack to see if we're directly under a `pre` tag, meaning we should ignore everything until we see the closing `pre`. Otherwise, we can collect text from inside heading tags as normal. Thus, the core changes in this commit are: - `grabbing` is a stack now, instead of a string - `markdown-to-ast` lets us filter for only HTML blocks - `htmlparser2` lets us check if we're inside a heading *or* pre tag
Fixes thlorenz#37, thlorenz#38, thlorenz#84, thlorenz#88. This commit builds upon the markdown-to-ast integration we added in thlorenz#91, using markdown-to-ast in `lib/get-html-headers.js`. We first filter our lines to only look for HTML sections (using the markdown parser), then in these HTML-only sections, we search for headers, as long as they're not inside pre tags. This is accomplished by keeping a stack of tags we've descended through. We can peek at the top of the stack to see if we're directly under a `pre` tag, meaning we should ignore everything until we see the closing `pre`. Otherwise, we can collect text from inside heading tags as normal. Thus, the core changes in this commit are: - `grabbing` is a stack now, instead of a string - `markdown-to-ast` lets us filter for only HTML blocks - `htmlparser2` lets us check if we're inside a heading *or* pre tag
Fixes thlorenz#37, thlorenz#38, thlorenz#84, thlorenz#88, thlorenz#99. This commit builds upon the markdown-to-ast integration we added in thlorenz#91, using markdown-to-ast in `lib/get-html-headers.js`. We first filter our lines to only look for HTML sections (using the markdown parser), then in these HTML-only sections, we search for headers, as long as they're not inside pre tags. This is accomplished by keeping a stack of tags we've descended through. We can peek at the top of the stack to see if we're directly under a `pre` tag, meaning we should ignore everything until we see the closing `pre`. Otherwise, we can collect text from inside heading tags as normal. Thus, the core changes in this commit are: - `grabbing` is a stack now, instead of a string - `markdown-to-ast` lets us filter for only HTML blocks - `htmlparser2` lets us check if we're inside a heading *or* pre tag
Closed via #107. |
some of my text in
The text was updated successfully, but these errors were encountered: