{"id":13830029,"url":"https://github.com/zenomt/pikchr-cmd","last_synced_at":"2026-03-08T21:04:21.551Z","repository":{"id":186426552,"uuid":"675146083","full_name":"zenomt/pikchr-cmd","owner":"zenomt","description":"Pikchr Command-Line Tool","archived":false,"fork":false,"pushed_at":"2024-05-26T19:56:06.000Z","size":358,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-04T10:02:17.485Z","etag":null,"topics":["composable","markdown","pikchr","tool"],"latest_commit_sha":null,"homepage":"https://zenomt.github.io/pikchr-cmd/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zenomt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-06T00:02:33.000Z","updated_at":"2024-08-04T10:02:20.237Z","dependencies_parsed_at":"2024-01-13T15:45:30.375Z","dependency_job_id":"4749e2d7-d054-4ea1-918b-242182185e05","html_url":"https://github.com/zenomt/pikchr-cmd","commit_stats":null,"previous_names":["zenomt/pikchr","zenomt/pikchr-cmd"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenomt%2Fpikchr-cmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenomt%2Fpikchr-cmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenomt%2Fpikchr-cmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenomt%2Fpikchr-cmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenomt","download_url":"https://codeload.github.com/zenomt/pikchr-cmd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225533039,"owners_count":17484185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composable","markdown","pikchr","tool"],"created_at":"2024-08-04T10:00:53.603Z","updated_at":"2026-03-08T21:04:21.544Z","avatar_url":"https://github.com/zenomt.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"Pikchr Command-Line Tool\n========================\n[This preprocessor tool][repo] reads text from the standard input, replacing\nsuitably-delimited [Pikchr][] (a [PIC][]-like diagram language) diagram\ndescriptions with inline [Scalable Vector Graphics (SVG)][SVG], and writes\nto the standard output.  It’s [intended to be composed][Unix] with your\nfavorite Markdown processor, but can be used standalone or with other markup\nlanguages or workflows too.\n\nThis tool uses the [C reference implementation of Pikchr by Richard Hipp][DRH]\nwhich is included here for convenience (as permitted by its generous license).\n\n\u003cdiv style=\"max-width:755px\"\u003e\n\u003csvg xmlns='http://www.w3.org/2000/svg' viewBox=\"0 0 755.453 217.44\" data-pikchr-date=\"20250321215505\" style='font-size:initial;'\u003e\n\u003cpolygon points=\"164.16,37.44 152.64,41.76 152.64,33.12\" style=\"fill:currentColor\"/\u003e\n\u003cpath d=\"M2.16,37.44L158.4,37.44\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"83.16\" y=\"25.74\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eMarkdown+Pikchr\u003c/text\u003e\n\u003ctext x=\"83.16\" y=\"49.14\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eSource\u003c/text\u003e\n\u003cpath d=\"M171.66,72.72L279.463,72.72A7.5 7.5 0 0 0 286.963 65.22L286.963,9.66A7.5 7.5 0 0 0 279.463 2.16L171.66,2.16A7.5 7.5 0 0 0 164.16 9.66L164.16,65.22A7.5 7.5 0 0 0 171.66 72.72Z\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"225.562\" y=\"17.28\" text-anchor=\"middle\" font-family=\"monospace\" fill=\"currentColor\" dominant-baseline=\"central\"\u003epikchr\u003c/text\u003e\n\u003ctext x=\"225.562\" y=\"37.44\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003ePreprocessor\u003c/text\u003e\n\u003ctext x=\"225.562\" y=\"57.6\" text-anchor=\"middle\" font-family=\"monospace\" fill=\"currentColor\" dominant-baseline=\"central\"\u003e(main.c)\u003c/text\u003e\n\u003cpolygon points=\"448.963,37.44 437.443,41.76 437.443,33.12\" style=\"fill:currentColor\"/\u003e\n\u003cpath d=\"M286.963,37.44L443.203,37.44\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"367.963\" y=\"25.74\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eMarkdown+SVG\u003c/text\u003e\n\u003ctext x=\"367.963\" y=\"49.14\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eIntermediate\u003c/text\u003e\n\u003cpath d=\"M456.463,72.72L579.473,72.72A7.5 7.5 0 0 0 586.973 65.22L586.973,9.66A7.5 7.5 0 0 0 579.473 2.16L456.463,2.16A7.5 7.5 0 0 0 448.963 9.66L448.963,65.22A7.5 7.5 0 0 0 456.463 72.72Z\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"517.968\" y=\"27.36\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eAny Markdown\u003c/text\u003e\n\u003ctext x=\"517.968\" y=\"47.52\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eFormatter\u003c/text\u003e\n\u003cpolygon points=\"748.973,37.44 737.453,41.76 737.453,33.12\" style=\"fill:currentColor\"/\u003e\n\u003cpath d=\"M586.973,37.44L743.213,37.44\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"667.973\" y=\"25.74\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eHTML+SVG\u003c/text\u003e\n\u003ctext x=\"667.973\" y=\"49.14\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eOutput\u003c/text\u003e\n\u003cpolygon points=\"225.562,72.72 229.882,84.24 221.242,84.24\" style=\"fill:currentColor\"/\u003e\n\u003cpolygon points=\"225.562,144.72 221.242,133.2 229.882,133.2\" style=\"fill:currentColor\"/\u003e\n\u003cpath d=\"M225.562,78.48L225.562,138.96\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"225.562\" y=\"108.72\" text-anchor=\"start\" fill=\"currentColor\" dominant-baseline=\"central\"\u003e C API\u003c/text\u003e\n\u003cpath d=\"M180.07,215.28L271.054,215.28A7.5 7.5 0 0 0 278.554 207.78L278.554,152.22A7.5 7.5 0 0 0 271.054 144.72L180.07,144.72A7.5 7.5 0 0 0 172.57 152.22L172.57,207.78A7.5 7.5 0 0 0 180.07 215.28Z\"  style=\"fill:none;stroke-width:2.16;stroke:currentColor;\" /\u003e\n\u003ctext x=\"225.562\" y=\"159.84\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003ePikchr\u003c/text\u003e\n\u003ctext x=\"225.562\" y=\"180\" text-anchor=\"middle\" fill=\"currentColor\" dominant-baseline=\"central\"\u003eFormatter\u003c/text\u003e\n\u003ctext x=\"225.562\" y=\"200.16\" text-anchor=\"middle\" font-family=\"monospace\" fill=\"currentColor\" dominant-baseline=\"central\"\u003e(pikchr.c)\u003c/text\u003e\n\u003c/svg\u003e\n\u003c/div\u003e\n\n\u003cdetails markdown=\"1\" open\u003e\n\n\u003csummary title=\"Click Me!\" style=\"font-size: smaller\"\u003ePikchr Source\u003c/summary\u003e\n\n    ``` pikchr @usage.svg requote delimiters x-current-color details open\n    arrow right 225% \"Markdown+Pikchr\" \"Source\"\n    Tool: box rad 5px \"pikchr\" mono \"Preprocessor\" \"(main.c)\" mono fit\n    arrow same \"Markdown+SVG\" \"Intermediate\"\n    box same \"Any Markdown\" \"Formatter\" fit height Tool.height\n    arrow same \"HTML+SVG\" \"Output\"\n    arrow \u003c-\u003e down from Tool.south \" C API\" ljust\n    box same \"Pikchr\" \"Formatter\" \"(pikchr.c)\" mono fit\n    ```\n\n\u003c/details\u003e\n\n\nGitHub doesn’t allow inline SVGs, so here’s the above diagram as an external\nimage reference (see Example 3 below):\n\n\u003cimg width=\"755px\" src=\"usage.svg\"/\u003e\n\nExample 1: Pipeline\n\n    $ pikchr \u003c file.md | md2html \u003e file.html\n\nExample 2: Intermediate file\n\n    $ pikchr \u003c README.md.in \u003e README.md\n    $ md2html \u003c README.md \u003e README.html\n\nExample 3: Compile the diagram in `README.md.in` that is tagged with modifier\n“`@usage.svg`” to a separate SVG file called `usage.svg`\n\n    $ pikchr -q -b -N @usage.svg \u003c README.md.in \u003e usage.svg\n\nDelimiters\n----------\nA Pikchr diagram starts with a line beginning with any of the following strings\n_without indentation_:\n\n* Three or more consecutive `GRAVE ACCENT` backtick (\u003ccode\u003e\u0026#96;\u003c/code\u003e)\n  characters, optional whitespace, the characters `pikchr`, and\n  whitespace or end-of-line; for example\n   - \u003ccode\u003e```` pikchr\u003c/code\u003e\n* Three or more consecutive `TILDE` (`~`) characters, optional whitespace,\n  the characters `pikchr`, and whitespace or end-of-line; for example\n   - `~~~pikchr`\n* The three characters `.PS` and whitespace or end-of-line (that is, the\n  traditional [PIC][] start delimiter)\n   - `.PS`\n\nand ends with the next line that is any of the following strings\n_without indentation_ (or the end of the file):\n\n* Three or more consecutive backtick characters and optional whitespace; for example\n   - \u003ccode\u003e```\u003c/code\u003e\n* Three or more consecutive `TILDE` characters and optional whitespace; for example\n   - `~~~~`\n* The three characters `.PE` and optional whitespace (that is, the traditional\n  [PIC][] end delimiter)\n   - `.PE`\n\nAnything not between a pair of start and end delimiters is copied to the\nstandard output unchanged.\n\nNote that generic Markdown [fenced code blocks][fenced] can begin with three\nor more consecutive `TILDE` (`~`) or backtick (\u003ccode\u003e\u0026#96;\u003c/code\u003e) characters\noptionally indented by up to three spaces, and continue to a fence of the\nsame type (tilde or backtick), optionally indented by up to three spaces, and\n_at least as long_. For simplicity, when looking for Pikchr diagrams, this\ntool doesn’t require the end delimiter to be of the same type or to be at\nleast as long as the start delimiter. This tool doesn’t recognize indented\nstart and end delimiters in order to easily accommodate displaying Pikchr\ncode itself by using an indented fenced code block.\n\n### Start Delimiter Modifiers\n\nAny number of whitespace-delimited modifier strings can follow the start\ndelimiter prefix on the same line. Modifiers can change the behavior of the\nPikchr formatter for just that diagram. Unrecognized modifiers are ignored,\nbut can be matched by the `-N` command-line option (use `-h` to see all of\nthe available options). The following modifiers are recognized:\n\n* `bare-svg`: Output the `\u003csvg\u003e` tag without wrapping it in a `\u003cdiv\u003e`. By default\n  (unless command-line option `-b` is given) each diagram is enclosed in a\n  `\u003cdiv\u003e` styled with `max-width` set to the diagram’s width, so it won’t\n  expand to the width of the page (which is usually not desired). `svg-only`\n  is a synonym for `bare-svg`.\n* `requote`: Output the Pikchr source of this diagram in an indented code block\n  after the compiled diagram. Use the `-R` command-line option to set this mode\n  for all diagrams.\n* `delimiters`: If requoting, include the start and end delimiter lines. The\n  default is to not include the start and end delimiters in a requote.\n* `details`: If requoting, put the requoted source into a `\u003cdetails\u003e`\n  element. Note that the output is [CommonMark][] compliant, but some older\n  non-CommonMark formatters (such as `Markdown.pl`) might format `\u003cdetails\u003e` incorrectly.\n  The `\u003csummary\u003e` content is set with the `-s` command-line option and defaults\n  to “`Pikchr Source`”. Use the `-D` command-line option to set this mode\n  for all diagrams.\n* `open`: Set the `open` attribute of the `\u003cdetails\u003e` element so that the\n  requoted Pikchr source starts out visible/open/disclosed.\n* `x-current-color`: Experimental, output CSS `currentColor` instead of\n  `rgb(0,0,0)` for numeric color value 0 (black, the default marking\n  color in diagrams). The diagram will be painted in the SVG element’s\n  inherited foreground color instead of the default black, which may enable\n  naturally adapting to different page themes or dark mode. Note that only\n  color value 0 is affected. To force black, set the color to a positive\n  number less than 0.5. Use the `-C` command-line option to set this\n  experimental mode for all diagrams.\n\nBuilding\n--------\n\n    $ git clone https://github.com/zenomt/pikchr-cmd\n    $ cd pikchr-cmd\n    $ make all\n    $ ./pikchr -h\n\nCommand Line Options\n--------------------\nThe following command line options are recognized:\n\n* \u003ccode\u003e-c \u003cem\u003eaClass\u003c/em\u003e\u003c/code\u003e  \n  Add attribute \u003ccode\u003eclass=\"\u003cem\u003eaClass\u003c/em\u003e\"\u003c/code\u003e to all generated `\u003csvg\u003e` tags.\n* \u003ccode\u003e-a \u003cem\u003earbitrary-attributes\u003c/em\u003e\u003c/code\u003e  \n  Add _arbitrary-attributes_ string to all generated `\u003csvg\u003e` tags. For compatibility with\n  the behavior of the latest upstream [Pikchr][], the default value is `style='font-size:initial;'`;\n  consider including this style directive if appropriate to any custom setting of this parameter.\n* \u003ccode\u003e-s \u003cem\u003esummary-content\u003c/em\u003e\u003c/code\u003e  \n  Change the raw HTML content of the `\u003csummary\u003e` element when requoting diagram source in a `\u003cdetails\u003e`\n  element. The default value is `Pikchr Source`.\n* \u003ccode\u003e-S \u003cem\u003earbitrary-attributes\u003c/em\u003e\u003c/code\u003e  \n  Add _arbitrary-attributes_ string to all generated `\u003csummary\u003e` tags.\n* `-b`  \n  “Bare SVG mode”: don’t enclose generated SVG elements in a `\u003cdiv\u003e`. By default a `\u003cdiv\u003e` wrapper is used to apply a `max-width` style to the diagram to keep it from expanding to the full window width. Use this option to manually style the diagram’s displayed size with your own DIV or when generating a standalone SVG file. This can also be enabled per-diagram with the `bare-svg` modifier.\n* `-p`  \n  Generate plaintext error messages. The default is to output HTML-formatted errors.\n* `-d`  \n  Enable “dark mode” in the Pikchr formatter. But consider using `-C` or modifier `x-current-color`\n  for a more flexible solution for “dark mode”.\n* `-C`  \n  Behave as though the experimental `x-current-color` modifier (use CSS `currentColor` instead of `rgb(0,0.0)` for numeric color value 0) was set on all diagrams. See the description of the `x-current-color` modifier above for more information.\n* `-R`  \n  Requote every diagram’s source, as though the `requote` modifier was set on all diagrams.\n* `-D`  \n  Put all requoted diagram source in `\u003cdetails\u003e` elements, as though the `details` modifier was set on all diagrams.\n* `-q`  \n  “Quiet mode”: don’t copy non-diagram input to the output. Use this option when generating a standalone SVG file.\n* `-Q`  \n  Remove all Pikchr diagrams from the output.\n* \u003ccode\u003e-N \u003ci\u003emod-string\u003c/i\u003e\u003c/code\u003e  \n  Only translate diagrams that have _mod-string_ as one of their [start delimiter modifiers](#start-delimiter-modifiers). This is usually used along with `-q` and `-b` when generating a standalone SVG file (in which case _mod-string_ should be unique).\n* `-h`  \n  Show the help message describing these options and quit.\n\nSVG to PNG Conversion Tool\n--------------------------\n[`svg2png.html`](https://zenomt.github.io/svg2png/svg2png.html) is a\ntiny and bare-bones HTML+JavaScript tool you can use to convert an SVG (such\nas one generated by the `pikchr` tool) to a\n[Portable Network Graphics (PNG)](https://www.w3.org/TR/png/) image file\nlocally using your web browser’s SVG rasterizer, for use in situations or\napplications that don’t support SVG.\n\n\n  [repo]: https://github.com/zenomt/pikchr-cmd\n  [SVG]: https://www.w3.org/Graphics/SVG/\n  [DRH]: https://github.com/drhsqlite/pikchr\n  [Pikchr]: https://pikchr.org/\n  [PIC]: https://en.wikipedia.org/wiki/PIC_(markup_language)\n  [fenced]: https://spec.commonmark.org/0.30/#fenced-code-blocks\n  [Unix]: https://en.wikipedia.org/wiki/Unix_philosophy\n  [CommonMark]: https://spec.commonmark.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenomt%2Fpikchr-cmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenomt%2Fpikchr-cmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenomt%2Fpikchr-cmd/lists"}