-
Notifications
You must be signed in to change notification settings - Fork 433
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
Toc nonstandard headers #337
Open
ryanvilbrandt
wants to merge
11
commits into
trentm:master
Choose a base branch
from
ryanvilbrandt:toc-nonstandard-headers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f9d2b3f
Added support for TOCs that don't start with h1 headers
ryanvilbrandt 4773b35
Added support for non-standard headers throughout the toc
ryanvilbrandt fe6f845
Added test cases
ryanvilbrandt 77fbd4a
Test case fix
ryanvilbrandt 4f5031f
Test case fix
ryanvilbrandt 4ef14d6
Fixed code highlighting unit tests
ryanvilbrandt 80a5dd2
Revert "Fixed code highlighting unit tests"
ryanvilbrandt 043ee7b
Removed Python 3.4 support
ryanvilbrandt 7bb6e63
Revert "Revert "Fixed code highlighting unit tests""
ryanvilbrandt 3e38011
Name fix
ryanvilbrandt 58b4d1b
Added task_list_checkable extra
ryanvilbrandt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ language: python | |
python: | ||
- "2.7" | ||
- "pypy" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
- "3.7-dev" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="codehilite"><pre><span></span><code><span class="k">if</span> <span class="bp">True</span><span class="p">:</span> | ||
<span class="k">print</span> <span class="s2">"hi"</span> | ||
<div class="codehilite"><pre><span></span><code><span class="k">if</span> <span class="kc">True</span><span class="p">:</span> | ||
<span class="nb">print</span> <span class="s2">"hi"</span> | ||
</code></pre></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<div class="codehilite"><pre><span></span><code><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span> | ||
<span class="k">print</span> <span class="s2">"foo"</span> | ||
<span class="nb">print</span> <span class="s2">"foo"</span> | ||
|
||
<span class="k">print</span> <span class="s2">"bar"</span> | ||
<span class="nb">print</span> <span class="s2">"bar"</span> | ||
</code></pre></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<p>Testing toc starting with a deeper header than h1</p> | ||
|
||
<h3 id="fruit">Fruit</h3> | ||
|
||
<ul> | ||
<li>apples</li> | ||
</ul> | ||
|
||
<h2 id="veggies">Veggies</h2> | ||
|
||
<ul> | ||
<li>carrots</li> | ||
</ul> | ||
|
||
<p>Testing a jump in toc over more than two "layers"</p> | ||
|
||
<h5 id="meat">Meat</h5> | ||
|
||
<ul> | ||
<li>beef</li> | ||
</ul> | ||
|
||
<h1 id="dairy">Dairy</h1> | ||
|
||
<ul> | ||
<li>milk</li> | ||
</ul> | ||
|
||
<p>Testing proper closing tags at end of toc</p> | ||
|
||
<h3 id="sugar">Sugar</h3> | ||
|
||
<ul> | ||
<li>candy</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"extras": ["toc"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
toc extra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Testing toc starting with a deeper header than h1 | ||
|
||
### Fruit | ||
|
||
- apples | ||
|
||
## Veggies | ||
|
||
- carrots | ||
|
||
Testing a jump in toc over more than two "layers" | ||
|
||
##### Meat | ||
|
||
- beef | ||
|
||
# Dairy | ||
|
||
- milk | ||
|
||
Testing proper closing tags at end of toc | ||
|
||
### Sugar | ||
|
||
- candy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<ul> | ||
<ul> | ||
<ul> | ||
<li><a href="#fruit">Fruit</a></li> | ||
</ul></li> | ||
<li><a href="#veggies">Veggies</a> | ||
<ul> | ||
<ul> | ||
<ul> | ||
<li><a href="#meat">Meat</a></li> | ||
</ul></li> | ||
</ul></li> | ||
</ul></li> | ||
</ul></li> | ||
<li><a href="#dairy">Dairy</a> | ||
<ul> | ||
<ul> | ||
<li><a href="#sugar">Sugar</a></li> | ||
</ul></li> | ||
</ul></li> | ||
</ul> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the orphaned li you mentioned? Is it present in master right now? Also wondering why we now have double nested ul in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that's the one. It probably doesn't exist in master right now, but I haven't taken a close look. I believe it's a side-effect of the change in this PR.
The double nested <ul> is the result of this PR. It allows for someone to place an <h5> after an <h3> and it indents twice in the TOC. This is happening in the toc_2 test case:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I'll take a look at the code. Definitely not ideal to have the malformed html. The double ul doesn't seem necessary either, from a markup perspective. Seems the purpose of the PR should be able to be accomplished without an unnecessary ul. I'll dive in soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think the nested
<ul>
is the right way to go. It seems odd, but it seems to follow good flow in the HTML where it relies on list level to determine indentation. It also means that markdown like this:will be handled similarly to markdown like this:
I'll also mess around with the code a bit and see if I can reorganize the
</li>
tags to be a bit clearer.