{"id":13601908,"url":"https://github.com/Jollywatt/typst-fletcher","last_synced_at":"2025-04-11T04:32:00.636Z","repository":{"id":207161248,"uuid":"718050253","full_name":"Jollywatt/typst-fletcher","owner":"Jollywatt","description":"Typst package for drawing diagrams with arrows, built on top of CeTZ.","archived":false,"fork":false,"pushed_at":"2024-04-11T20:42:46.000Z","size":34014,"stargazers_count":142,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-12T00:53:45.831Z","etag":null,"topics":["cetz","commutative-diagrams","diagrams","flowchart","tikzcd","typst"],"latest_commit_sha":null,"homepage":"","language":"Typst","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/Jollywatt.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}},"created_at":"2023-11-13T09:16:15.000Z","updated_at":"2024-07-10T13:40:45.549Z","dependencies_parsed_at":"2024-01-01T03:39:55.927Z","dependency_job_id":"bc308168-2dcc-4bae-8bd8-027ab7470514","html_url":"https://github.com/Jollywatt/typst-fletcher","commit_stats":null,"previous_names":["jollywatt/arrow-diagrams","jollywatt/typst-fletcher"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jollywatt%2Ftypst-fletcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jollywatt%2Ftypst-fletcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jollywatt%2Ftypst-fletcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jollywatt%2Ftypst-fletcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jollywatt","download_url":"https://codeload.github.com/Jollywatt/typst-fletcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223458699,"owners_count":17148504,"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":["cetz","commutative-diagrams","diagrams","flowchart","tikzcd","typst"],"created_at":"2024-08-01T18:01:09.875Z","updated_at":"2025-04-11T04:32:00.575Z","avatar_url":"https://github.com/Jollywatt.png","language":"Typst","funding_links":[],"categories":["Typst"],"sub_categories":[],"readme":"![Version](https://img.shields.io/badge/version-0.5.7-green)\n[![Development version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fgithub.com%2FJollywatt%2Ftypst-fletcher%2Fraw%2Fdev%2Ftypst.toml\u0026query=package.version\u0026label=dev\u0026color=blue)](https://github.com/Jollywatt/typst-fletcher/tree/dev)\n[![Repo](https://img.shields.io/badge/GitHub-repo-blue)](https://github.com/Jollywatt/typst-fletcher)\n\n# fletcher\n\n_**fletcher** (noun) a maker of arrows_\n\nA [Typst](https://typst.app/) package for drawing diagrams with arrows,\nbuilt on top of [CeTZ](https://github.com/johannes-wolf/cetz).\n\nSee the [manual](docs/manual.pdf?raw=true) for documentation or ask the community for help.\n\n[![Manual](https://img.shields.io/badge/docs-manual.pdf-orange)](docs/manual.pdf?raw=true)\n[![Ask on Discord](https://img.shields.io/badge/ask-on%20Typst%20forum-239dad\n)](https://forum.typst.app)\n[![Ask on Discord](https://img.shields.io/badge/ask-on%20Discord-2a4d7e\n)](https://discord.com/channels/1054443721975922748/1260973351900414102)\n\n\n```typ\n#import \"@preview/fletcher:0.5.7\" as fletcher: diagram, node, edge\n```\n\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/readme-examples/1-first-isomorphism-theorem-dark.svg\"\u003e\n  \u003cimg src=\"docs/readme-examples/1-first-isomorphism-theorem-light.svg\"\u003e\n\u003c/picture\u003e\n\n```typ\n#diagram(cell-size: 15mm, $\n\tG edge(f, -\u003e) edge(\"d\", pi, -\u003e\u003e) \u0026 im(f) \\\n\tG slash ker(f) edge(\"ur\", tilde(f), \"hook--\u003e\")\n$)\n```\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/readme-examples/2-flowchart-trap-dark.svg\"\u003e\n  \u003cimg src=\"docs/readme-examples/2-flowchart-trap-light.svg\"\u003e\n\u003c/picture\u003e\n\n```typ\n// https://xkcd.com/1195/\n#import fletcher.shapes: diamond\n#set text(font: \"Comic Neue\", weight: 600) // testing: omit\n\n#diagram(\n\tnode-stroke: 1pt,\n\tnode((0,0), [Start], corner-radius: 2pt, extrude: (0, 3)),\n\tedge(\"-|\u003e\"),\n\tnode((0,1), align(center)[\n\t\tHey, wait,\\ this flowchart\\ is a trap!\n\t], shape: diamond),\n\tedge(\"d,r,u,l\", \"-|\u003e\", [Yes], label-pos: 0.1)\n)\n```\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/readme-examples/3-state-machine-dark.svg\"\u003e\n  \u003cimg src=\"docs/readme-examples/3-state-machine-light.svg\"\u003e\n\u003c/picture\u003e\n\n```typ\n#set text(10pt)\n#diagram(\n\tnode-stroke: .1em,\n\tnode-fill: gradient.radial(blue.lighten(80%), blue, center: (30%, 20%), radius: 80%),\n\tspacing: 4em,\n\tedge((-1,0), \"r\", \"-|\u003e\", `open(path)`, label-pos: 0, label-side: center),\n\tnode((0,0), `reading`, radius: 2em),\n\tedge(`read()`, \"-|\u003e\"),\n\tnode((1,0), `eof`, radius: 2em),\n\tedge(`close()`, \"-|\u003e\"),\n\tnode((2,0), `closed`, radius: 2em, extrude: (-2.5, 0)),\n\tedge((0,0), (0,0), `read()`, \"--|\u003e\", bend: 130deg),\n\tedge((0,0), (2,0), `close()`, \"-|\u003e\", bend: -40deg),\n)\n```\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/readme-examples/4-feynman-diagram-dark.svg\"\u003e\n  \u003cimg src=\"docs/readme-examples/4-feynman-diagram-light.svg\"\u003e\n\u003c/picture\u003e\n\n```typ\n#diagram($\n\te^- edge(\"rd\", \"-\u003c|-\") \u0026 \u0026 \u0026 edge(\"ld\", \"-|\u003e-\") e^+ \\\n\t\u0026 edge(gamma, \"wave\") \\\n\te^+ edge(\"ru\", \"-|\u003e-\") \u0026 \u0026 \u0026 edge(\"lu\", \"-\u003c|-\") e^- \\\n$)\n```\n\n\n\n\n# More examples\nPull requests are most welcome!\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/1-commutative.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/1-commutative.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/2-algebra-cube.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/2-algebra-cube.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/3-ml-architecture.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/3-ml-architecture.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/4-io-flowchart.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/4-io-flowchart.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/5-digraph.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/5-digraph.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/6-node-groups.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/6-node-groups.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/7-uml-diagram.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/7-uml-diagram.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd style=\"background: white;\"\u003e\n      \u003ca href=\"docs/gallery/8-tree.typ\"\u003e\n        \u003ccenter\u003e\n          \u003cimg src=\"docs/gallery/8-tree.svg\" width=\"100%\"/\u003e\n        \u003c/center\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\n## Change log\n\n### 0.5.7\n\n- Update `cetz` dependency to `0.3.4` fixing bugs with `typst` version `0.13.1` (#89, #90, #91).\n\n### 0.5.6\n\n- **Require `typst` version `\u003e=0.13.0`.**\n- Update `cetz` dependency to `0.3.3`.\n- Support CeTZ anchors on nodes which dynamically enclose other nodes (#81).\n- Allow nested enclosing of nodes (#45).\n- Add `floating` option to `edge()` to make certain objects not affect the diagram's bounds (#38).\n- Make `debug` annotations \"floating\" so they don't affect diagram size and layout.\n\n### 0.5.5\n\n- Update `cetz` dependency to `0.3.2`.\n- Fix deprecated type comparisons (#75).\n- Add space ` ` line style for empty stroke (#70).\n- Fix bug with `label-side` for corner edges (#74).\n\n### 0.5.4\n\n- Allow relative lengths for the `label-pos` option of `edge()` (#61).\n- Fix layout bugs for diagrams with non-default `axes` options (#62, #66).\n- Fix a line breaking issue with justified text in nodes (#64).\n\n### 0.5.3\n\n- Support CeTZ anchors in edge coordinates, e.g., `edge(\u003ca.east\u003e, ..)`.\n- Fix crash when `stroke: none` set on polyline edges (#60, [@SillyFreak](https://github.com/SillyFreak!)).\n- Fix bug with crossing edges in math mode (#54).\n- Fix layout bugs for diagrams with non-default `axes` options (#62, #66).\n\n### 0.5.2\n\n- **Require `typst` version `\u003e=0.12.0`.**\n- Update `cetz` dependency to `0.3.1`. **Note:** This may slightly change edge label positions.\n- Add `loop-angle` option to `edge()` (#36).\n\n### 0.5.1\n\n- Fix nodes which `enclose` absolute coordinates.\n- Allow CeTZ-style coordinate expressions in node `enclose` option.\n- Fix crash with polar coordinates.\n- Fix edges which bend at 0deg or 180deg (e.g., `edge(\"r,r\")` or `edge(\"r,l\")`) and enhance the way the corner radius adapts to the bend angle. **Note:** This may change diagram layout from previous versions.\n- Improve error messages.\n- Add marks for crow's foot notation: `n` (many), `n?` (zero or more), `n!` (one or more), `1` (one), `1?` (zero or one), `1!` (exactly one).\n- Add `node-shape` option to `diagram()`.\n\n### 0.5.0\n\n- Greatly enhance coordinate system.\n  - Support CeTZ-style coordinate expressions (relative, polar, interpolating, named coordinates, etc).\n  - Absolute coordinates (physical lengths) can be used alongside \"elastic\" coordinates (row/column positions).\n- Add `label-angle` option to `edge()`.\n- Add `label-wrapper` option to allow changing the label inset, outline stroke, and so on (#26).\n- Add `label-size` option to control default edge label text size (#35)\n- Add `trapezium` node shape.\n- Disallow string labels to be passed as positional arguments to `edge()` (to eliminate ambiguity). Used named argument or pass content instead.\n\n### 0.4.5\n\n- Add isosceles triangle node shape (#31).\n- Add `fit` and `dir` options to various node shapes to adjust sizing and orientation.\n- Allow more than one consecutive edge to have an implicit end vertex.\n- Allow `snap-to` to be `none` to disable edge snapping (#32).\n\n### 0.4.4\n\n- Support fully customisable marks/arrowheads!\n  - Added new mark styles and tweaked some existing defaults. **Note.** This may change the micro-typography of diagrams from previous versions.\n- Add node groups via the `enclose` option of `node()`.\n- Node labels can be aligned inside the node with `align()`.\n- Node labels wrap naturally when label text is wider than the node. **Note:** This may change diagram layout from previous versions.\n- Add a `layer` option to nodes and edges to control drawing order.\n- Add node shapes: `ellipse`, `octagon`.\n\n### 0.4.3\n\n- Fixed edge crossing backgrounds being drawn above nodes (#14).\n- Add `fletcher.hide()` to hide elements with/without affecting layout, useful for incremental diagrams in slides (#15).\n- Support `shift`ing edges by coordinate deltas as well as absolute lengths (#13).\n- Support node names (#8).\n\n### 0.4.2\n\n- Improve edge-to-node snapping. Edges can terminate anywhere near a node (not just at its center) and will automatically snap to the node outline. Added `snap-to` option to `edge()`.\n- Fix node `inset` being half the amount specified. If upgrading from previous version, you will need to divide node `inset` values by two to preserve diagram layout.\n- Add `decorations` option to `edge()` for CeTZ path decorations (`\"wave\"`, `\"zigzag\"`, and `\"coil\"`, also accepted as positional string arguments).\n\n### 0.4.1\n\n- Support custom node shapes! Edges connect to node outlines automatically.\n  - New `shapes` submodule, containing `diamond`, `pill`, `parallelogram`, `hexagon`, and other node shapes.\n- Allow edges to have multiple segments.\n  - Add `vertices` an `corner-radius` options to `edge()`.\n  - Relative coordinate shorthands may be comma separated to signify multiple segments, e.g., `\"r,u,ll\"`.\n- Add `dodge` option to `edge()` to adjust end points.\n- Support `cetz:0.2.0`.\n\n### 0.4.0\n\n- Add ability to specify diagrams in math-mode, using `\u0026` to separate nodes.\n- Allow implicit and relative edge coordinates, e.g., `edge(\"d\")` becomes `edge(prev-node, (0, 1))`.\n- Add ability to place marks anywhere along an edge. Shorthands now accept an optional middle mark, for example `|-\u003e-|` and `hook-/-\u003e\u003e`.\n- Add “hanging tail” correction to marks on curved edges. Marks now rotate a bit to fit more comfortably along tightly curving arcs.\n- Add more arrowheads for the sake of it: `}\u003e`, `\u003c{`, `/`, `\\`, `x`, `X`, `*` (solid dot), `@` (solid circle).\n- Add `axes` option to `diagram()` to control the direction of each axis in the diagram's coordinate system.\n- Add `width`, `height` and `radius` options to `node()` for explicit control over size.\n- Add `corner-radius` option to `node()`.\n- Add `stroke` option to `edge()` replacing `thickness` and `paint` options.\n- Add `edge-stroke` option to `diagram()` replacing `edge-thickness`.\n\n### 0.3.0\n\n- Make round-style arrow heads better approximate the default math font.\n- Add solid arrow heads with shorthand `\u003c|-`, `-|\u003e` and double-bar `||-`, `-||`.\n- Add an `extrude` option to `node()` which duplicates and extrudes the node's stroke, enabling double stroke effects.\n\n### 0.2.0\n\n- Experimental support for customising arrowheads.\n- Add right-angled edges with `edge(..., corner: left/right)`.\n\n## Star History\n\n\u003ca href=\"https://star-history.com/#jollywatt/typst-fletcher\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=jollywatt/typst-fletcher\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=jollywatt/typst-fletcher\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=jollywatt/typst-fletcher\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJollywatt%2Ftypst-fletcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJollywatt%2Ftypst-fletcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJollywatt%2Ftypst-fletcher/lists"}