https://github.com/ad-si/hikchr
Haskell wrapper + CLI tool for Pikchr, a PIC-like markup language for diagrams.
https://github.com/ad-si/hikchr
diagram haskell markup pic pikchr
Last synced: 6 months ago
JSON representation
Haskell wrapper + CLI tool for Pikchr, a PIC-like markup language for diagrams.
- Host: GitHub
- URL: https://github.com/ad-si/hikchr
- Owner: ad-si
- License: bsd-3-clause
- Created: 2025-01-18T18:31:34.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-01-19T13:37:17.000Z (9 months ago)
- Last Synced: 2025-04-21T06:18:48.033Z (6 months ago)
- Topics: diagram, haskell, markup, pic, pikchr
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/hikchr
- Size: 99.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Hikchr
Hikchr is a Haskell wrapper for [Pikchr](https://pikchr.org/),
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:```haskell
import Hikchrmain :: 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 pikchrScriptcase 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:```shell
hikchr graph.pikchr > graph.svgecho "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 "" - "" \
> example.html
```