-
taggyis an easy-to-use library for tagging structured text, see example below. -
With
taggyyou can make good-looking slides in pdf via latex. See example here. Future plans include generation of markdown and html. Contributions welcome. -
taggyis a zero-dependency Scala 3 micro-library that shows how you can construct a concise and type-safe embedded DSL using a modern Scala abstraction mechanism called Contextual Abstraction -
taggyis pleasant to use thanks to the simple syntax of Optional Braces. -
You need to have
latexmkfrom TexLive on your path to build slides in pdf. Install it on Ubuntu usingsudo apt install texlive-full
-
See example usage of
taggybelow using the newscalarunner that can automatically downloadtaggyas a Github dependency. -
Copy-paste the text below and save it in a file called
my-slides.scalaor similar in an empty new folder and doscala-cli run .in that folder.
//> using scala 3.5.0
//> using dep "taggy:taggy:1.0.1,url=https://github.com/bjornregnell/taggy/releases/download/v1.0.1/taggy_3-1.0.1.jar"
// Above 2 "magic" comments: just copy-paste them, bump Scala version if Latest is newer.
// Latest Scala release here: https://www.scala-lang.org/
// run this command with at least Scala 3.5 in terminal to create slides in target/out.pdf
// scala run .
import taggy.*
@main def run = slides.toPdf()
def slides = document("Taggy Slide Example", author = "Oddput Clementine"):
frame("Greetings in two languages"):
p("Nice greetings:")
itemize:
p("English: Hello world!")
p("Swedish: Hej världen!")
p("By micro-lib https://github.com/bjornregnell/taggy and awesome Scala")- Instead of doing the copy-paste-save above you can just run this command in Ubuntu and you should get to see slides in your pdf viewer when ready:
curl -fL https://github.com/bjornregnell/taggy/releases/download/v1.0.1/init-slides.sh | bash- See more examples in example.scala.
NOTE: If you run into errors like Latex ERROR in target/out.log and Package babel Error: Unknown option 'swedish'. when latexmk is compiling then you are missing a latex package and need to do sudo apt install texlive-lang-european (if you do sudo apt install texlive-full you will get everything needed but its a bigger install). More info here
Using Scala >= 3.5.0 create a library jar with this command:
scala package taggy.scala -o taggy_3-1.0.1.jar --libraryPublishing requires maintainer access. If you use gh see manual: https://cli.github.com/manual/
-
Bump all versions in README.md, example.scala, init-slides.sh
-
Test everything:
scala clean . rm -rf target scala run . xdg-open target/out.pdf -
Commit and push all changes
git commit -am "prepare release" && git push -
Build the jar:
scala package taggy.scala -o taggy_3-1.0.1.jar --library -
Draft a new release on https://github.com/bjornregnell/taggy/releases
gh release create v1.0.1 --generate-notes -
Build (see above) and upload jar named
taggy_3-1.0.1.jarandinit-slides.shgh release upload v1.0.1 taggy_3-1.0.1.jar init-slides.sh target/out.pdf