From f4c3c0e7ccad6f6d74d3ee97600484ab8c7f0272 Mon Sep 17 00:00:00 2001 From: Noel Welsh Date: Fri, 12 Apr 2024 14:55:22 +0100 Subject: [PATCH] Use Creative Scala theme plugin --- build.sbt | 17 +-- .../main/scala/introduction/01-basics.scala | 3 +- docs/src/css/creative-scala.css | 111 ------------------ docs/src/templates/default.template.html | 46 -------- project/plugins.sbt | 2 +- 5 files changed, 4 insertions(+), 175 deletions(-) delete mode 100644 docs/src/css/creative-scala.css delete mode 100644 docs/src/templates/default.template.html diff --git a/build.sbt b/build.sbt index 6cbb4c0..5cf5964 100644 --- a/build.sbt +++ b/build.sbt @@ -84,36 +84,21 @@ lazy val docs = ) ), mdocIn := file("docs/src/pages"), - css := { - val src = file("docs/src/css") - val dest1 = mdocOut.value - val dest2 = (laikaSite / target).value - val cmd1 = - s"npx tailwindcss -i ${src.toString}/creative-scala.css -o ${dest1.toString}/creative-scala.css" - val cmd2 = - s"npx tailwindcss -i ${src.toString}/creative-scala.css -o ${dest2.toString}/creative-scala.css" - cmd1 ! - - cmd2 ! - }, Laika / sourceDirectories ++= Seq( - file("docs/src/js"), (examples.js / Compile / fastOptJS / artifactPath).value .getParentFile() / s"${(examples.js / moduleName).value}-fastopt" ), - laikaTheme := creativeScalaTheme, + laikaTheme := CreativeScalaTheme.empty.addJs(laika.ast.Path.Root / "main.js").build, laikaExtensions ++= Seq( laika.format.Markdown.GitHubFlavor, laika.config.SyntaxHighlighting, - CreativeScalaDirectives ), tlSite := Def .sequential( (examples.js / Compile / fastLinkJS), // (Compile / run).toTask(""), mdoc.toTask(""), - css, laikaSite ) .value, diff --git a/code/src/main/scala/introduction/01-basics.scala b/code/src/main/scala/introduction/01-basics.scala index 8989a16..bcd2a81 100644 --- a/code/src/main/scala/introduction/01-basics.scala +++ b/code/src/main/scala/introduction/01-basics.scala @@ -27,7 +27,8 @@ import cats.effect.* object Basics extends IOApp.Simple { // 0. This object extends IOApp.Simple. This allows us to run the object. It // expects an IO with the name `run` which describes the program it will run. - // So replace `run` below with whatever you want to see when your program is run. + // So replace `run` below with whatever you want to see when your program is + // run. val run = IO(println("Hello!")) // 1. You can create an IO using IO(...) and IO.pure(...). (The former is the diff --git a/docs/src/css/creative-scala.css b/docs/src/css/creative-scala.css deleted file mode 100644 index f1e8eb5..0000000 --- a/docs/src/css/creative-scala.css +++ /dev/null @@ -1,111 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -body { - @apply text-slate-900 text-lg font-serif bg-white xl:flex; -} -nav#topbar { - @apply w-full flex justify-around content-center text-white bg-slate-800 p-2 text-xl xl:hidden; -} -nav#topbar p { - @apply p-0 m-0; -} -nav#sidebar { - @apply bg-slate-800 hidden max-w-sm p-12 xl:flex-none xl:block; -} -li.level1.nav-leaf { - @apply list-none text-pink-300 mt-4; -} -ul.nav-list:first-child { - @apply mt-0; -} -li.level1 { - @apply list-none text-pink-300 mt-4; -} -li.level2 { - @apply list-none text-slate-300 pl-4; -} - -.default-image-block { - @apply m-4 clear-both; -} - -#content { - @apply flex-auto p-12; -} - -main { - display: grid; - grid-template-columns: [main-start] minmax(20ch, 70ch) [main-end] minmax(0ch,20ch) [overflow-end]; -} -.content * { - grid-column-start: main-start; - grid-column-end: main-end; -} -h1, h2, h3, h4 { - @apply text-pink-800; -} -h1 { - @apply text-6xl mb-16; -} -h2 { - @apply text-4xl mb-2; -} -h3 { - @apply text-2xl mb-2; -} -h4 { - @apply text-xl; -} - - -p { - @apply mb-4; -} -.content ol.arabic { - @apply list-decimal list-outside pl-4 mb-4; -} -.content ul { - @apply list-disc list-outside pl-4 mb-4; -} -.content pre { - grid-column-start: main-start; - grid-column-end: overflow-end; -} -.content a { - @apply underline decoration-dotted decoration-1 hover:decoration-2 text-sky-500; -} -pre { - @apply mb-4 p-2 bg-slate-100; -} -code { - @apply text-sm; - font-family: "Source Code Pro", ui-monospace, monospace; -} -pre code .number-literal, .char-literal, .boolean-literal, .string-literal { - @apply text-sky-600; -} -pre code .keyword { - @apply text-rose-600; -} -pre code .identifier { - @apply text-slate-600; -} -pre code .type-name { - @apply text-green-600; -} -pre code .declaration-name { - @apply text-blue-600; -} -pre code .comment { - @apply italic; -} - - -.nextPage { - @apply mt-4 text-right text-xl text-pink-800; -} -footer { - @apply mt-4 pt-4 border-t-2 border-slate-300 text-slate-300 text-center text-sm font-sans; -} diff --git a/docs/src/templates/default.template.html b/docs/src/templates/default.template.html deleted file mode 100644 index db70ed7..0000000 --- a/docs/src/templates/default.template.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - ${cursor.currentDocument.title} - @:for(laika.site.metadata.authors) - - @:@ - @:for(laika.site.metadata.description) - - @:@ - - - - - - - - - - - -
-
- ${cursor.currentDocument.content} - @:nextPage -
- -
- - - - - diff --git a/project/plugins.sbt b/project/plugins.sbt index ccff9c7..91b3c15 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,4 +5,4 @@ addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0") addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.7") addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.7") -addSbtPlugin("org.creativescala" % "creative-scala-theme" % "0.1.0-SNAPSHOT") +addSbtPlugin("org.creativescala" % "creative-scala-theme" % "0.2.0")