Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gebv/pikchr
wrapper around the `pikchr.c` for use in Golang and vscode extenstion for on-the-fly preview
https://github.com/gebv/pikchr
diagrams go golang pikchr vscode-extension
Last synced: 17 days ago
JSON representation
wrapper around the `pikchr.c` for use in Golang and vscode extenstion for on-the-fly preview
- Host: GitHub
- URL: https://github.com/gebv/pikchr
- Owner: gebv
- License: mit
- Created: 2021-01-21T06:36:07.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-31T09:57:33.000Z (almost 4 years ago)
- Last Synced: 2024-11-15T21:02:26.888Z (about 2 months ago)
- Topics: diagrams, go, golang, pikchr, vscode-extension
- Language: C
- Homepage:
- Size: 7.98 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pikchr
![CI](https://github.com/gebv/pikchr/workflows/CI/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/gebv/pikchr)](https://goreportcard.com/report/github.com/gebv/pikchr)
This repository is a wrapper around the `pikchr.c` for use in Golang.
`pikchr.c` and `pikchr.h` version downloaded from that [https://pikchr.org/home/dir?ci=tip&type=tree](https://pikchr.org/home/dir?ci=tip&type=tree) on 2020-12-04 21:07:42.
[pikchr syntax](https://pikchr.org/home/doc/trunk/doc/grammar.md)**Render server.** If need server to generate diagrams on-the-fly via http API - [follow link](./renderserver/README.md)
You can use a shared server for rendering (set by default in settings in the vscode-extention) or deploy your server
**VSCode extension**. VSCode extension for quick diagram debugging. Follow link - https://marketplace.visualstudio.com/items?itemName=gebv.pikchr
If you have questions, comments, or suggestions, please visit the [GitHub Discussion board](https://github.com/gebv/pikchr/discussions).
**(expereminal version) CLI tools for render SVG from your md file with code blocks with source code of diagram**. [Follow link](./cmd/md2pikchrs/README.md) for details
mac
```
brew install gebv/tap/md2pikchrs
``````bash
md2pikchrs -out ./_out -in ./_tmp/*.md
# 2021/01/31 10:58:54 md2pikchrs version: 1.0.2#f6608d1b842dfc76cb16c6de44703b12fccd95bd
# 2021/01/31 10:58:54 ./_tmp/demo.md total 4 code blocks
# 2021/01/31 10:58:54 ./_tmp/demo.md 4 interesting code blocks
# 2021/01/31 10:58:54 ./_tmp/demo.md fil1.svg rendering...
# 2021/01/31 10:58:54 ./_tmp/demo.md fil1.svg - OK
# 2021/01/31 10:58:54 ./_tmp/demo.md foo_bar rendering...
# 2021/01/31 10:58:54 ./_tmp/demo.md foo_bar.svg - OK
# 2021/01/31 10:58:54 ./_tmp/demo.md foo_bar.svg rendering...
# 2021/01/31 10:58:54 ./_tmp/demo.md foo_bar.svg - OK
# 2021/01/31 10:58:54 ./_tmp/demo.md foo_bar.svg rendering...
# 2021/01/31 10:58:54 ./_tmp/demo.md foo_bar.svg - OK
```# What is pikchr?
> Pikchr (pronounced "picture") is a PIC-like markup language for diagrams in technical documentation. Pikchr is designed to be embedded in fenced code blocks of Markdown or similar mechanisms of other documentation markup languages.
>
> For example, the diagram:
>
>
>
> Is generated by 7 lines of Markdown:
>
> ``` pikchr
> 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
> ```[More deatils on the official website](https://pikchr.org/home/doc/trunk/homepage.md)
# Example of the use
```go
package mainimport (
"fmt""github.com/gebv/pikchr"
)func main() {
in := `arrow right 200% "Markdown" "Source"
box rad 10px "Markdown" "Formatter" "(markdown.c)" fit
arrow right 200% "HTML+SVG" "Output"
arrow <-> down from last box.s
box same "Pikchr" "Formatter" "(pikchr.c)" fit
`
res, ok := pikchr.Render(
in,
// pikchr.Dark(), // render the image in dark mode
// pikchr.SVGClass("foobar"), // add class="%s" to
// pikchr.HTMLError(), // wrap the error message text with a html
)
fmt.Println("Success?", ok)
fmt.Println("Width =", res.Width)
fmt.Println("Height =", res.Height)
fmt.Println()
fmt.Println(res.Data)
}// Output:
// Success? true
// Width = 423
// Height = 217//
//
//
// Markdown
// Source
//
// Markdown
// Formatter
// (markdown.c)
//
//
// HTML+SVG
// Output
//
//
//
//
// Pikchr
// Formatter
// (pikchr.c)
//```
# Render server
Server to generate diagrams on-the-fly via http API. [More details.](./renderserver/README.md)