-
Notifications
You must be signed in to change notification settings - Fork 43
/
README.md.tmpl
191 lines (147 loc) · 6.67 KB
/
README.md.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!-- XX Move this file down to .github/, because its contents are GitHub-specific. -->
# GoAT: Go ASCII Tool
<!-- Github-specific status icon
Github requires explicitly binding a repository owner's username in the text of a README,
implying that a badge in README.md cannot both reflect the status of a test Action after a
contributor pushes to his pull request branch, and
the run of that same test Action after the upstream owner merges the pull request
into his 'main' branch. See:
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge
GitHub Community forum shows numerous similar issues with badges:
https://github.com/orgs/community/discussions/categories/actions?discussions_q=is%3Aopen+category%3AActions++badge.svg
=> CONCLUSION: Don't use badges. Instead, pay attention to Action result status.
-->
<!-- ![](https://github.com/{{.Github_Repository_Owner}}/goat/actions/workflows/test.yml/badge.svg) -->
## What **GoAT** Can Do For You
- From a chunky ASCII-art source drawing, render polished, graphically-rich [SVG](#complicated),
with the [goat](#installation) CLI command.
<!-- https://github.com/dmullis/goat/tree/main#installation -->
- Tie together all three of:
1. Your code's major data structures or abstract data/control flows.
2. Related ASCII-art diagrams embedded in comments, adjacent to the source code.
3. Polished line diagrams in your user-facing high-level documentation, with inline links
to SVG produced by [goat](./cmd/goat).
For Markdown or similar formats, links may be expanded either at build-time or run-time,
as needed by your doc tool suite.
Your ASCII-art source persists as the single-point-of-truth, revision-controlled along with
the code that embeds it.
This README contains an [example](#library-data-flow).
## You Will Also Need
#### Graphical- or Rectangle-oriented text editing capability
Both **vim** and **emacs** offer useful support.
In Emacs, see the built-in rectangle-editing commands, and ```picture-mode```.
#### A fixed-pitch font with 2:1 height:width ratio as presented by your editor and terminal emulator
Most fixed-pitch or "monospace" Unicode fonts maintain a 2:1 aspect ratio for
characters in the ASCII range,
and all GoAT drawing characters are ASCII.
However, certain Unicode graphical characters e.g. MIDDLE DOT may be useful, and
conform to the width of the ASCII range.
CJK characters on the other hand are typically wider than 2:1.
Non-standard width characters are not in general composable on the left-right axis within a plain-text
drawing, because the remainder of the line of text to their right is pushed out of alignment
with rows above and below.
## Installation
```
$ go install github.com/{{.Github_Repository_Owner}}/goat/cmd/goat@latest
```
<!-- https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections#creating-a-collapsed-section -->
## Example Graphics
Here are some snippets of
GoAT-formatted UTF-8
and the SVG each can generate.
The SVG you see below was linked to by
inline Markdown image references
([howto](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images),
[spec](https://github.github.com/gfm/#images)) from
GoAT's [README.md](README.md), then finally rendered to HTML ```<img>``` elements by Github's Markdown processor
### Trees
```
{{.trees_txt}}
```
![](/examples/trees.svg)
### Trees -- mid-range color value
Setting a foreground color in the middle of the possible range of value or luminance
is one way to work around a limitation of certain browsers e.g. Safari.
Safari does not support inheritance of
the [`color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
CSS property by
`goat`'s output `<svg>` element
from within an enclosing `<img>` element such as are generated by Markdown.
![](/trees.mid-blue.svg)
### Overlaps
```
{{.overlaps_txt}}
```
![](/examples/overlaps.svg)
### Line Decorations
```
{{.line_decorations_txt}}
```
![](/examples/line-decorations.svg)
### Line Ends
```
{{.line_ends_txt}}
```
![](/examples/line-ends.svg)
### Dot Grids
```
{{.dot_grids_txt}}
```
Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character, encoded with UTF-8.
![](/examples/dot-grids.svg)
### Large Nodes
```
{{.large_nodes_txt}}
```
![](/examples/large-nodes.svg)
### Small Grids
```
{{.small_grids_txt}}
```
![](/examples/small-grids.svg)
### Big Grids
```
{{.big_grids_txt}}
```
![](/examples/big-grids.svg)
### Complicated
```
{{.complicated_txt}}
```
![](/examples/complicated.svg)
### More examples are [here](examples)
## The GoAT Library
The core engine of ```goat``` is accessible as a Go library package, for inclusion in specialized
code of your own.
The code implements a subset, and some extensions, of the ASCII diagram generation function of the browser-side Javascript in [Markdeep](http://casual-effects.com/markdeep/).
A nicely formatted reference may be found at [pkg.go.dev](https://pkg.go.dev/github.com/{{.Github_Repository_Owner}}/goat).
### Installation
```
$ go get -u github.com/{{.Github_Repository_Owner}}/goat/
```
### Library Data Flow
![](/goat.svg)
The diagram above was derived by [./pre-push.sh](./pre-push.sh) from ASCII-art in the Go
source file [./goat.go](./goat.go).
#### Auto-formatted API docs
<!--
XX XX May need a Github Action to do this substitution at "push" time.
[![resource non-responsive](https://pkg.go.dev/badge/github.com/{{.Github_Repository_Owner}}/goat)](https://pkg.go.dev/github.com/{{.Github_Repository_Owner}}/goat)
-->
<!--
The scraping of GitHub by godocs.io (see https://sr.ht) does NOT include README.md;
whereas Google's pkg.go.dev does do so, and apparently runs its own variant of GFM processing :-/
[![resource non-responsive](https://godocs.io/github.com/{{.Github_Repository_Owner}}/goat?status.svg)](https://godocs.io/github.com/{{.Github_Repository_Owner}}/goat)
-->
### Project Tenets
1. Utility and ease of integration into existing projects are paramount.
2. Compatibility with MarkDeep desired, but not required.
3. TXT and SVG intelligibility are co-equal in priority.
4. Composability of TXT not to be sacrificed -- only width-8 characters allowed.
5. Per-platform support limited to a single widely-available fixed-pitch TXT font.
[@bep]: https://github.com/bep/goat/
[@dmacvicar]: https://github.com/dmacvicar/goat
[@sw46]: https://github.com/sw46/goat/
[SVG]: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics
[markdeep.mini.js]: http://casual-effects.com/markdeep/
[v0.93.0]: https://github.com/gohugoio/hugo/releases/tag/v0.93.0