hikchr: Haskell wrapper for Pikchr, a PIC-like markup language for diagrams.

[ bsd3, diagram, library, program, svg ] [ Propose Tags ] [ Report a vulnerability ]

Please see the README on GitHub at https://github.com/ad-si/Hikchr#readme


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), bytestring (>=0.11.5 && <0.12), hikchr, optparse-applicative, text (>=2.0.2 && <2.1) [details]
Tested with ghc ==9.8.2, ghc ==9.6.4, ghc ==9.4.8
License BSD-3-Clause
Copyright Adrian Sieber
Author Adrian Sieber
Maintainer mail@adriansieber.com
Category Diagram, Svg
Home page https://github.com/ad-si/Hikchr#readme
Bug tracker https://github.com/ad-si/Hikchr/issues
Source repo head: git clone https://github.com/ad-si/Hikchr
Uploaded by adrian at 2025-01-18T21:41:27Z
Distributions
Executables hikchr
Downloads 28 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for hikchr-0.2.0.0

[back to package description]

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