Skip to content
/ Hikchr Public

Haskell wrapper + CLI tool for Pikchr, a PIC-like markup language for diagrams.

License

Notifications You must be signed in to change notification settings

ad-si/Hikchr

Repository files navigation

Hikchr

Hikchr is a Haskell wrapper for Pikchr, a PIC-like markup language for diagrams.

Library

Install by adding hikchr to your *.cabal file and use the hikchr functions to convert Pikchr scripts to SVG:

import Hikchr

main :: IO ()
main = do
  let pikchrScript = """
        arrow right 200% "Markdown" "Source"
        box rad 10px "Markdown" "Formatter" "(markdown.c)" fit
        arrow right 200% "HTML+SVG" "Output"
        arrow <-> down 70% from last box.s
        box same "Pikchr" "Formatter" "(pikchr.c)" fit
      """

  svgResult <- hikchrCustom
      ( HikchrConfig
          { svgClass = Just "example"
          , darkMode = False
          , width = Nothing
          , height = Nothing
          }
      )
      pikchrScript

  -- Without configuration:
  -- svgResult <- hikchr pikchrScript

  case svgResult of
    Left err -> putErrText err
    Right svg -> writeFile "example.svg" svg

will generate following SVG:

CLI

Install by running cabal install hikchr or stack install hikchr and use the hikchr command like this:

hikchr graph.pikchr > graph.svg

echo "box \"Hello\"" | hikchr > hello.svg

hikchr --dark-mode graph.pikchr > graph-dark.svg

hikchr --class graph graph.pikchr > graph.svg

hikchr example1.pikchr example2.pikchr \
| cat "<html><body>" - "</body></html>" \
> example.html

About

Haskell wrapper + CLI tool for Pikchr, a PIC-like markup language for diagrams.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published