Skip to content

A Scala 3 library for tagging text and making nice slides.

License

Notifications You must be signed in to change notification settings

bjornregnell/taggy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is taggy?

  • taggy is an easy-to-use api for tagging structured text, see example below.

  • With taggy you can make good-looking slides in pdf via latex. See example here. Future plans include generation of markdown and html.

  • taggy is a zero-dependency Scala 3 library that shows how you can construct a concise and type-safe Scala-embedded DSL using contextual abstraction.

  • WARNING: taggy is a proof-of-concept and still under development. It benefits from an experimental feature of the Scala 3.2.nightly compiler called fewerBraces.

  • You need to have latexmk from TexLive on your path. Install it on Ubuntu using sudo apt install texlive-full

How to use taggy?

  • See example usage of taggy below, with scala-cli that automatically downloads taggy as a Github dependency.
  • Copy-paste the text below and save it in a file called my-slides.scala in an empty new folder and do scala-cli run . in that folder.
// Two magic comments used by scala-cli (just copy-paste them):
//> using lib "taggy:taggy:0.0.5,url=https://github.com/bjornregnell/taggy/releases/download/v0.0.5/taggy_3-0.0.5.jar"
//> using scala "3.3.0-RC3"

//  run this command in terminal to create slides in target/out.pdf 
//  scala-cli run .

import taggy.*

@main def run = slides.toPdf()

def slides = document("Taggy Slide Example"):
  frame("Greetings in two languages"):
    p("Nice greetings:")
    itemize:
      p("English: Hello world!")
      p("Swedish: Hej världen!")
    p("https://github.com/bjornregnell/taggy")
  • Instead of doing the copy-paste-save above you can just run this command and you should get see slides in a pdf viewer when ready:
curl -fL https://github.com/bjornregnell/taggy/releases/download/v0.0.5/init-slides.sh | bash
  • See more examples here.

How to build taggy?

scala-cli --power package taggy.scala -o taggy_3-0.0.5.jar --library

How to publish taggy?