Skip to content

Commit 23160aa

Browse files
committed
[Console] Create consistent console screenshots
1 parent b1242c8 commit 23160aa

11 files changed

+157
-12
lines changed
-69.2 KB
Loading

_images/components/console/cursor.gif

-48.4 KB
Loading
Loading
Loading
Loading

_images/sources/README.md

+46-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
How to Create Symfony Diagrams
2-
==============================
1+
How to Create Symfony Images
2+
============================
33

4-
Creating the Diagram
5-
--------------------
4+
Creating Diagrams
5+
-----------------
66

77
* Use [Dia][1] as the diagramming application;
88
* Use [PT Sans Narrow][2] as the only font in all diagrams (if possible, use
@@ -21,8 +21,7 @@ Creating the Diagram
2121
In case of doubt, check the existing diagrams or ask to the
2222
[Symfony Documentation Team][3].
2323

24-
Saving and Exporting the Diagram
25-
--------------------------------
24+
### Saving and Exporting the Diagram
2625

2726
* Save the original diagram in `*.dia` format in `_images/sources/<folder-name>`;
2827
* Export the diagram to SVG format and save it in `_images/<folder-name>`.
@@ -33,8 +32,7 @@ that transforms text into vector shapes (resulting file is larger in size, but
3332
it's truly portable because text is displayed the same even if you don't have
3433
some fonts installed).
3534

36-
Including the Diagram in the Symfony Docs
37-
-----------------------------------------
35+
### Including the Diagram in the Symfony Docs
3836

3937
Use the following snippet to embed the diagram in the docs:
4038

@@ -44,21 +42,57 @@ Use the following snippet to embed the diagram in the docs:
4442
<object data="../_images/<folder-name>/<diagram-file-name>.svg" type="image/svg+xml"></object>
4543
```
4644

47-
Reasoning
48-
---------
45+
### Reasoning
4946

5047
* Dia was chosen because it's one of the few applications which are free, open
5148
source and compatible with Linux, macOS and Windows.
5249
* Font, colors and line widths were chosen to be similar to the diagrams used
5350
in the best tech books.
5451

55-
Troubleshooting
56-
---------------
52+
### Troubleshooting
5753

5854
* On some macOS systems, Dia cannot be executed as a regular application and
5955
you must run the following console command instead:
6056
`export DISPLAY=:0 && /Applications/Dia.app/Contents/Resources/bin/dia`
6157

58+
Creating Console Screenshots
59+
----------------------------
60+
61+
* Use [Asciinema][4] to record the console session locally:
62+
63+
```
64+
$ asciinema rec -c bash recording.cast
65+
```
66+
* Use `$ ` as the prompt in recordings. E.g. if you're using Bash, add the
67+
following lines to your ``.bashrc``:
68+
69+
```
70+
if [ "$ASCIINEMA_REC" = "1" ]; then
71+
PS1="\e[37m$ \e[0m"
72+
fi
73+
```
74+
* Save the generated asciicast in `_images/sources/<folder-name>`.
75+
76+
### Rendering the Recording
77+
78+
Rendering the recording can be a difficult task. The [documentation team][3]
79+
is always ready to help you with this task (e.g. you can open a PR with
80+
only the asciicast file).
81+
82+
* Use [agg][5] to generated a GIF file from the recording;
83+
* Use the ``_images/sources/ascii-render.sh`` file to call agg:
84+
85+
```
86+
AGG_PATH=/path/to/agg ./_images/sources/ascii-render.sh recording.cast --cols 45 --rows 20
87+
```
88+
89+
This utility configures a predefined theme;
90+
* Always configure `--cols`` (width) and ``--rows`` (height), try to use as
91+
low as possible numbers. Do not exceed 70 columns;
92+
* Save the generated GIF file in `_images/<folder-name>`.
93+
6294
[1]: http://dia-installer.de/
6395
[2]: https://fonts.google.com/specimen/PT+Sans+Narrow
6496
[3]: https://symfony.com/doc/current/contributing/code/core_team.html
97+
[4]: https://github.com/asciinema/asciinema
98+
[5]: https://github.com/asciinema/agg

_images/sources/ascii-render.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env sh
2+
case "$1" in
3+
''|help|-h)
4+
echo "ansi-render.sh RECORDING [options]"
5+
echo ""
6+
echo " RECORDING: path to the .cast file generated by asciinema"
7+
echo " [options]: optional options to be passed to agg"
8+
;;
9+
*)
10+
recording=$1
11+
extra_options=
12+
if [ $# -gt 1 ]; then
13+
shift
14+
extra_options=$@
15+
fi
16+
17+
# --theme 1f2937,f9fafb,8b949e,ff7b72,7ee787,ffa657,79c0ff,d2a8ff,a5d6ff,8b949e \
18+
# 1f4631
19+
# --cols 92 --rows 10
20+
${AGG_PATH:-agg} \
21+
--theme 18202a,f9fafb,f9fafb,ff7b72,1f4631,ffa657,79c0ff,d2a8ff,a5d6ff,f9fafb,8b949e,ff7b72,00c300,ffa657,79c0ff,d2a8ff,a5d6ff,f9fafb --line-height 1.6 \
22+
$extra_options \
23+
$recording $(echo $recording | sed "s/cast/gif/")
24+
;;
25+
esac
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{"version": 2, "width": 76, "height": 30, "timestamp": 1663253713, "env": {"SHELL": "/usr/bin/fish", "TERM": "st-256color"}}
2+
[0.00798, "o", "\u001b[?2004h\u001b[90m$ \u001b[0m"]
3+
[0.614685, "o", "b"]
4+
[0.776549, "o", "i"]
5+
[0.86682, "o", "n"]
6+
[1.092426, "o", "/"]
7+
[1.332671, "o", "c"]
8+
[1.55068, "o", "o"]
9+
[1.630651, "o", "n"]
10+
[1.784584, "o", "s"]
11+
[1.873108, "o", "o"]
12+
[2.074652, "o", "l"]
13+
[2.180433, "o", "e"]
14+
[2.260475, "o", " "]
15+
[2.696628, "o", "\u0007"]
16+
[2.947263, "o", "\r\nabout debug:event-dispatcher\r\nassets:install debug:router\r\ncache:clear help\r\ncache:pool:clear lint:container\r\ncache:pool:delete lint:yaml\r\ncache:pool:list list\r\ncache:pool:prune router:match\r\ncache:warmup secrets:decrypt-to-local\r\ncompletion secrets:encrypt-from-local\r\nconfig:dump-reference secrets:generate-keys\r\ndebug:autowiring secrets:list\r\ndebug:config secrets:remove\r\ndebug:container secrets:set\r\ndebug:dotenv \r\n\u001b[37m$ \u001b[0mbin/console "]
17+
[3.614479, "o", "s"]
18+
[3.802449, "o", "e"]
19+
[4.205631, "o", "\u0007crets:"]
20+
[4.520435, "o", "r"]
21+
[4.598031, "o", "e"]
22+
[5.026287, "o", "move "]
23+
[5.47041, "o", "\u0007SOME_"]
24+
[5.673941, "o", "\u0007"]
25+
[6.024086, "o", "\r\nSOME_OTHER_SECRET SOME_SECRET \r\n\u001b[37m$ \u001b[0mbin/console secrets:remove SOME_"]
26+
[6.770627, "o", "O"]
27+
[7.14335, "o", "THER_SECRET "]
28+
[7.724482, "o", "\r\n\u001b[?2004l\r"]
29+
[7.776657, "o", "\r\n"]
30+
[7.779108, "o", "\u001b[30;42m \u001b[39;49m\r\n\u001b[30;42m [OK] Secret \"SOME_OTHER_SECRET\" removed from \"config/secrets/dev/\". \u001b[39;49m\r\n\u001b[30;42m \u001b[39;49m\r\n\r\n"]
31+
[7.782993, "o", "\u001b[?2004h\u001b[37m$ \u001b[0m"]
32+
[9.214537, "o", "e"]
33+
[9.522429, "o", "x"]
34+
[9.690371, "o", "i"]
35+
[9.85446, "o", "t"]
36+
[10.292412, "o", "\r\n\u001b[?2004l\r"]
37+
[10.292526, "o", "exit\r\n"]
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{"version": 2, "width": 191, "height": 30, "timestamp": 1663251833, "env": {"SHELL": "/usr/bin/fish", "TERM": "st-256color"}}
2+
[0.007941, "o", "\u001b[?2004h\u001b[90m$ \u001b[0m"]
3+
[0.566363, "o", "c"]
4+
[0.643353, "o", "l"]
5+
[0.762325, "o", "e"]
6+
[0.952363, "o", "a"]
7+
[0.995878, "o", "r"]
8+
[1.107784, "o", "\r\n\u001b[?2004l\r"]
9+
[1.109766, "o", "\u001b[H\u001b[2J"]
10+
[1.109946, "o", "\u001b[?2004h\u001b[30m$ \u001b[0m"]
11+
[1.653461, "o", "p"]
12+
[1.772323, "o", "h"]
13+
[1.856444, "o", "p"]
14+
[1.980339, "o", " "]
15+
[2.15827, "o", "c"]
16+
[2.273242, "o", "u"]
17+
[2.402231, "o", "r"]
18+
[2.563066, "o", "s"]
19+
[2.760266, "o", "o"]
20+
[2.900252, "o", "r"]
21+
[3.020537, "o", "."]
22+
[3.316404, "o", "p"]
23+
[3.403213, "o", "h"]
24+
[3.483391, "o", "p"]
25+
[3.820273, "o", "\r\n\u001b[?2004l\r"]
26+
[3.845697, "o", "\u001b[6;9H#"]
27+
[4.045942, "o", "\u001b[8;9H#"]
28+
[4.246327, "o", "\u001b[8;2H#####"]
29+
[4.446737, "o", "\u001b[2;9H#######"]
30+
[4.647128, "o", "\u001b[7;7H#"]
31+
[4.84749, "o", "\u001b[3;9H#"]
32+
[5.047857, "o", "\u001b[7;9H#"]
33+
[5.248246, "o", "\u001b[4;9H#"]
34+
[5.448622, "o", "\u001b[2;2H#####"]
35+
[5.648999, "o", "\u001b[3;7H#"]
36+
[5.849378, "o", "\u001b[5;9H#####"]
37+
[6.049711, "o", "\u001b[3;1H#"]
38+
[6.250118, "o", "\u001b[7;1H#"]
39+
[6.45056, "o", "\u001b[5;2H#####"]
40+
[6.650897, "o", "\u001b[4;1H#"]
41+
[6.851281, "o", "\u001b[6;7H#"]
42+
[7.051644, "o", "\u001b[9;1H"]
43+
[7.058802, "o", "\u001b[?2004h\u001b[30m$ \u001b[0m"]
44+
[7.657612, "o", "e"]
45+
[7.846956, "o", "x"]
46+
[7.949451, "o", "i"]
47+
[8.0893, "o", "t"]
48+
[8.201144, "o", "\r\n\u001b[?2004l\r"]
49+
[8.201227, "o", "exit\r\n"]
31.7 KB
Loading

0 commit comments

Comments
 (0)