forked from blampe/goat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md.tmpl
137 lines (108 loc) · 4.23 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
# GoAT: Go ASCII Tool
## What **GoAT** Can Do For You
- From a chunky ASCII-art source drawing, render polished, graphically-rich [SVG](#complicated),
with the [goat](./cmd/goat) CLI command.
- 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/{{.GithubUser}}/goat/cmd/goat@latest
```
## Examples
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}}
```

### Overlaps
```
{{.overlaps_txt}}
```

### Line Decorations
```
{{.line_decorations_txt}}
```

### Line Ends
```
{{.line_ends_txt}}
```

### Dot Grids
```
{{.dot_grids_txt}}
```
Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character, encoded with UTF-8.

### Large Nodes
```
{{.large_nodes_txt}}
```

### Small Grids

```
{{.small_grids_txt}}
```
### Big Grids
```
{{.big_grids_txt}}
```

### Complicated
```
{{.complicated_txt}}
```

### 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/).
### library Data Flow

The diagram above was derived by [./make.sh](./make.sh) from ASCII-art in the Go
source file [./goat.go](./goat.go).
#### 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