Skip to content
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

Allow for non-H1 headers #18

Merged
merged 2 commits into from
Sep 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/main/scala/com/lightbend/paradox/markdown/Page.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ object Page {
// TODO: get default label node from page index link?
val targetPath = convertPath(page.path)
val (h1, subheaders) = page.headers match {
case h :: hs if h.label.level == 1 => (Header(h.label.path, h.label.markdown), h.children ++ hs)
case hs => (Header(targetPath, new SpecialTextNode(targetPath)), hs)
case h :: hs => (Header(h.label.path, h.label.markdown), h.children ++ hs)
case hs => (Header(targetPath, new SpecialTextNode(targetPath)), hs)
}
val headers = subheaders map (_ map (h => Header(h.path, h.markdown)))
Page(page.file, targetPath, h1.label, h1, headers, page.markdown)
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/sbt-test/paradox/site/expected/a.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<li><a href="b/a/a.html">BAA</a></li>
<li><a href="b/b.html">BB</a></li>
</ul></li>
<li><a href="c/a.html">CA</a></li>
</ul>
<a href="a/a.html">AA</a>
<h1><a href="#a" name="a" class="anchor"><span class="anchor-link"></span></a>A</h1>
Expand Down Expand Up @@ -66,6 +67,7 @@ <h1><a href="#a" name="a" class="anchor"><span class="anchor-link"></span></a>A<
<li><a href="b/b.html#bb4">BB4</a></li>
</ul></li>
</ul></li>
<li><a href="c/a.html">CA</a></li>
</ul>
</div>
<p>Followed by the index of a select number of pages.</p>
Expand Down
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/expected/a/a.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<li><a href="../b/a/a.html">BAA</a></li>
<li><a href="../b/b.html">BB</a></li>
</ul></li>
<li><a href="../c/a.html">CA</a></li>
</ul>
<a href="../a.html">A</a>
<a href="../a/b.html">AB</a>
Expand Down
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/expected/a/b.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<li><a href="../b/a/a.html">BAA</a></li>
<li><a href="../b/b.html">BB</a></li>
</ul></li>
<li><a href="../c/a.html">CA</a></li>
</ul>
<a href="../a/a.html">AA</a>
<a href="../a/c.html">AC</a>
Expand Down
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/expected/a/c.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<li><a href="../b/a/a.html">BAA</a></li>
<li><a href="../b/b.html">BB</a></li>
</ul></li>
<li><a href="../c/a.html">CA</a></li>
</ul>
<a href="../a/b.html">AB</a>
<a href="../b/a.html">BA</a>
Expand Down
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/expected/b/a.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<li><a href="../b/a/a.html">BAA</a></li>
<li><a href="../b/b.html">BB</a></li>
</ul></li>
<li><a href="../c/a.html">CA</a></li>
</ul>
<a href="../a/c.html">AC</a>
<a href="../b/a/a.html">BAA</a>
Expand Down
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/expected/b/a/a.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<li><a href="../../b/a/a.html" class="active">BAA</a></li>
<li><a href="../../b/b.html">BB</a></li>
</ul></li>
<li><a href="../../c/a.html">CA</a></li>
</ul>
<a href="../../b/a.html">BA</a>
<a href="../../b/b.html">BB</a>
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/sbt-test/paradox/site/expected/b/b.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
<li><a href="../b/a/a.html">BAA</a></li>
<li><a href="../b/b.html" class="active">BB</a></li>
</ul></li>
<li><a href="../c/a.html">CA</a></li>
</ul>
<a href="../b/a/a.html">BAA</a>
<a href="../c/a.html">CA</a>
<h1><a href="#bb" name="bb" class="anchor"><span class="anchor-link"></span></a>BB</h1>
<p>This is the &ldquo;BB&rdquo; page.</p>
<h2><a href="#bb2" name="bb2" class="anchor"><span class="anchor-link"></span></a>BB2</h2>
Expand Down
35 changes: 35 additions & 0 deletions plugin/src/sbt-test/paradox/site/expected/c/a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CA · Paradox Test</title>
<meta name="description" content="Paradox Test"/>
</head>
<body>
<a href="../">base</a>
<a href="../a.html">A</a>
0.1-SNAPSHOT
<ul>
<li><a href="https://abc.xyz/">Alphabet</a></li>
<li><a href="https://www.google.com">Google</a></li>
<li><a href="../a.html">A</a></li>
<li>CA</li>
</ul>
<ul>
<li><a href="../a/a.html">AA</a>
<ul>
<li><a href="../a/b.html">AB</a></li>
<li><a href="../a/c.html">AC</a></li>
</ul></li>
<li><a href="../b/a.html">BA</a>
<ul>
<li><a href="../b/a/a.html">BAA</a></li>
<li><a href="../b/b.html">BB</a></li>
</ul></li>
<li><a href="../c/a.html" class="active">CA</a></li>
</ul>
<a href="../b/b.html">BB</a>
<h2><a href="#ca" name="ca" class="anchor"><span class="anchor-link"></span></a>CA</h2>
<p>This is the &ldquo;CA&rdquo; page.</p>
<p>It starts with a H2 header instead of an H1.</p>
</body>
</html>
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/src/main/paradox/a.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Followed by the index of a select number of pages.
- [aa](a/a.md)
- [ba](b/a.md)
- [baa](b/a/a.md)
- [ca](c/a.md)
@@@
5 changes: 5 additions & 0 deletions plugin/src/sbt-test/paradox/site/src/main/paradox/c/a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## CA

This is the "CA" page.

It starts with a H2 header instead of an H1.
1 change: 1 addition & 0 deletions plugin/src/sbt-test/paradox/site/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ $ must-mirror target/paradox/site/a/c.html expected/a/c.html
$ must-mirror target/paradox/site/b/a.html expected/b/a.html
$ must-mirror target/paradox/site/b/a/a.html expected/b/a/a.html
$ must-mirror target/paradox/site/b/b.html expected/b/b.html
$ must-mirror target/paradox/site/c/a.html expected/c/a.html
$ must-mirror target/paradox/site/css/page.css expected/css/page.css
$ must-mirror target/paradox/site/images/a.png expected/images/a.png