-
Notifications
You must be signed in to change notification settings - Fork 8
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
Integrate with sbt-typelevel-site #127
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2c806fd
Integrate with sbt-typelevel-site
armanbilge abadf10
Update the README
armanbilge 85b2dc1
Regenerate workflow
armanbilge efde310
prePR
armanbilge 2bffb52
Re-enable favicon
armanbilge ab8dfa9
Keep resources scoped
armanbilge 00cc944
Use version variable
armanbilge e9d8a44
Delete metals.sbt
armanbilge 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
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,2 +1,4 @@ | ||
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.1") | ||
val sbtTypelevelVersion = "0.4.1" | ||
addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion) | ||
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion) | ||
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.16") |
108 changes: 108 additions & 0 deletions
108
core/src/main/resources/org/http4s/sbt/default.template.html
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,108 @@ | ||
<!DOCTYPE html> | ||
<html lang="${?laika.site.metadata.language}"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="generator" content="Laika 0.18.0 + Helium Theme" /> | ||
<title>${cursor.currentDocument.title}</title> | ||
@:for(laika.site.metadata.authors) | ||
<meta name="author" content="${_}"/> | ||
@:@ | ||
@:for(laika.site.metadata.description) | ||
<meta name="description" content="${_}"/> | ||
@:@ | ||
@:for(helium.favIcons) | ||
<link rel="icon" @:attribute(sizes, _.sizes) @:attribute(type, _.type) @:attribute(href, _.target)/> | ||
@:@ | ||
@:for(helium.webFonts) | ||
<link rel="stylesheet" href="${_}"> | ||
@:@ | ||
@:linkCSS { paths = ${helium.site.includeCSS} } | ||
@:linkJS { paths = ${helium.site.includeJS} } | ||
@:heliumInitVersions | ||
@:heliumInitPreview(container) | ||
<script> /* for avoiding page load transitions */ </script> | ||
</head> | ||
|
||
<body> | ||
|
||
<header id="top-bar"> | ||
|
||
<!-- visibility trickery, for layout to match http4s.org --> | ||
<div class="row" style="visibility:hidden"> | ||
<a id="nav-icon"> | ||
@:icon(navigationMenu) | ||
</a> | ||
<div id="version-menu-container"> | ||
<a id="version-menu-toggle" class="text-link drop-down-toggle" href="#"> | ||
Version 1.0 | ||
</a> | ||
<nav id="version-menu"> | ||
<ul id="version-list" class="nav-list"> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
|
||
${?helium.topBar.home} | ||
|
||
${?helium.topBar.links} | ||
|
||
</header> | ||
|
||
<nav id="sidebar"> | ||
|
||
<!-- custom start - adjust left navigation - add extra section --> | ||
@:navigationTree { | ||
entries = [ | ||
{ target = "/README.md", excludeSections = true } | ||
{ target = "/", excludeRoot = true, excludeSections = true, depth = 2 } | ||
] | ||
} | ||
|
||
<ul class="nav-list"> | ||
<li class="level1 nav-header">Related Projects</li> | ||
<li class="level2"><a href="https://http4s.org/">http4s</a></li> | ||
<li class="level2"><a href="https://github.com/http4s/blaze">blaze</a></li> | ||
<li class="level2"><a href="https://jdk-http-client.http4s.org/">http4s-jdk-http-client</a></li> | ||
<li class="level2"><a href="https://http4s.github.io/http4s-dom/">http4s-dom</a></li> | ||
<li class="level2"><a href="https://github.com/http4s/rho">rho</a></li> | ||
<li class="level2"><a href="https://github.com/http4s/sbt-http4s-org">sbt-http4s-org</a></li> | ||
<li class="level2"><a href="https://github.com/typelevel/feral">feral</a></li> | ||
</ul> | ||
<!-- custom end --> | ||
|
||
</nav> | ||
|
||
<div id="container"> | ||
|
||
<nav id="page-nav"> | ||
<p class="header"><a href="#">${cursor.currentDocument.title}</a></p> | ||
|
||
@:navigationTree { | ||
entries = [ | ||
{ target = "#", excludeRoot = true, depth = 2 } | ||
] | ||
} | ||
|
||
<p class="footer">@:for(helium.markupEditLinks)<a href="${_.baseURL}${cursor.currentDocument.path}">${_.icon}${_.text}</a>@:@</p> | ||
</nav> | ||
|
||
<main class="content"> | ||
|
||
${cursor.currentDocument.content} | ||
|
||
<!-- custom start - integrate footer, a feature not yet available in Helium --> | ||
<hr style="margin-top: 30px"/> | ||
<footer style="font-size: 90%; text-align: center"> | ||
http4s is a <a href="https://typelevel.org/">Typelevel</a> Project distributed under the <a href="https://github.com/http4s/http4s/LICENSE">Apache 2 License</a>. | ||
</footer> | ||
<!-- custom end --> | ||
|
||
</main> | ||
|
||
</div> | ||
|
||
</body> | ||
</html> |
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,9 @@ | ||
header img { | ||
height: 28px; | ||
width: auto; | ||
margin-top: 6px; | ||
} | ||
|
||
#sidebar li.nav-header { | ||
margin-top: -20px; | ||
} |
114 changes: 114 additions & 0 deletions
114
core/src/main/scala/org/http4s/sbt/Http4sOrgSitePlugin.scala
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,114 @@ | ||
/* | ||
* Copyright 2020 http4s.org | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.http4s.sbt | ||
|
||
import cats.effect.IO | ||
import laika.ast.LengthUnit._ | ||
import laika.ast.Path.Root | ||
import laika.ast._ | ||
import laika.helium.Helium | ||
import laika.helium.config.Favicon | ||
import laika.helium.config.HeliumIcon | ||
import laika.helium.config.IconLink | ||
import laika.helium.config.ImageLink | ||
import laika.rewrite.DefaultTemplatePath | ||
import laika.sbt.LaikaPlugin | ||
import laika.theme.config.Color | ||
import org.typelevel.sbt._ | ||
import sbt.Keys._ | ||
import sbt._ | ||
|
||
object Http4sOrgSitePlugin extends AutoPlugin { | ||
|
||
override def requires = TypelevelSitePlugin && LaikaPlugin | ||
|
||
import TypelevelSitePlugin.autoImport._ | ||
import LaikaPlugin.autoImport._ | ||
|
||
override def projectSettings: Seq[Setting[_]] = Seq( | ||
laikaInputs ~= { | ||
// Laika natively supports classpath resources but there's something fiddly with that in sbt | ||
_.delegate | ||
.addStream( | ||
IO.blocking(getClass.getResourceAsStream("default.template.html")), | ||
DefaultTemplatePath.forHTML | ||
) | ||
.addStream( | ||
IO.blocking(getClass.getResourceAsStream("site/styles.css")), | ||
Root / "site" / "styles.css" | ||
) | ||
}, | ||
tlSiteHeliumConfig := { | ||
Helium.defaults.all | ||
.metadata( | ||
language = Some("en"), | ||
title = Some("http4s") | ||
) | ||
.site | ||
.layout( | ||
contentWidth = px(860), | ||
navigationWidth = px(275), | ||
topBarHeight = px(35), | ||
defaultBlockSpacing = px(10), | ||
defaultLineHeight = 1.5, | ||
anchorPlacement = laika.helium.config.AnchorPlacement.Right | ||
) | ||
.site | ||
.themeColors( | ||
primary = Color.hex("5B7980"), | ||
secondary = Color.hex("cc6600"), | ||
primaryMedium = Color.hex("a7d4de"), | ||
primaryLight = Color.hex("e9f1f2"), | ||
text = Color.hex("5f5f5f"), | ||
background = Color.hex("ffffff"), | ||
bgGradient = | ||
(Color.hex("334044"), Color.hex("5B7980")) // only used for landing page background | ||
) | ||
.site | ||
.favIcons( | ||
Favicon | ||
.external("https://http4s.org/images/http4s-favicon.svg", "32x32", "image/svg+xml") | ||
.copy(sizes = None), | ||
Favicon.external("https://http4s.org/images/http4s-favicon.png", "32x32", "image/png") | ||
) | ||
.site | ||
.darkMode | ||
.disabled | ||
.site | ||
.topNavigationBar( | ||
homeLink = ImageLink.external( | ||
"https://http4s.org", | ||
Image.external("https://http4s.org/v1.0/images/http4s-logo-text-dark-2.svg")), | ||
navLinks = tlSiteApiUrl.value.toList.map { url => | ||
IconLink.external( | ||
url.toString, | ||
HeliumIcon.api, | ||
options = Styles("svg-link") | ||
) | ||
} ++ Seq( | ||
IconLink.external( | ||
scmInfo.value.fold("https://github.com/http4s")(_.browseUrl.toString), | ||
HeliumIcon.github, | ||
options = Styles("svg-link")), | ||
IconLink.external("https://discord.gg/XF3CXcMzqD", HeliumIcon.chat), | ||
IconLink.external("https://twitter.com/http4s", HeliumIcon.twitter) | ||
) | ||
) | ||
} | ||
) | ||
|
||
} |
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 @@ | ||
../README.md |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,10 @@ | ||
// DO NOT EDIT! This file is auto-generated. | ||
|
||
// This plugin enables semantic information to be produced by sbt. | ||
// It also adds support for debugging using the Debug Adapter Protocol | ||
|
||
addSbtPlugin("org.scalameta" % "sbt-metals" % "0.11.1") | ||
|
||
// This plugin adds the BSP debug capability to sbt server. | ||
|
||
addSbtPlugin("ch.epfl.scala" % "sbt-debug-adapter" % "2.0.12") |
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,11 @@ | ||
// DO NOT EDIT! This file is auto-generated. | ||
|
||
// This plugin enables semantic information to be produced by sbt. | ||
// It also adds support for debugging using the Debug Adapter Protocol | ||
|
||
addSbtPlugin("org.scalameta" % "sbt-metals" % "0.11.1") | ||
|
||
// This plugin makes sure that the JDI tools are in the sbt classpath. | ||
// JDI tools are used by the debug adapter server. | ||
|
||
addSbtPlugin("org.scala-debugger" % "sbt-jdi-tools" % "1.1.1") |
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 @@ | ||
../core/src/ |
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.
This is ugly in the GitHub README but it becomes useful information on the live site.