-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowcase
executable file
·102 lines (70 loc) · 2.59 KB
/
showcase
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
#!/usr/bin/env bash
output_showcase() {
printf "%s" "
$(f_heading "heading")
plain free text.
text with inline formatting for $(f_bold "bold"), $(f_strike "strikethrough"), and $(f_italics "italics").
$(f_under "underlined") text will be rendered correctly in terminal, but has no effect in markdown.
text with inline formatting for $(f_code "code"), and $(f_link "a link" 'https://github.com/eliranmal/styli.sh').
$(f_subheading "subheading")
a sprinkle of free text.
$(f_code_block \
'code block with no highlighting')
$(f_code_block \
"sh" \
'echo "code block with shell highlighting"')
some more free text.
$(f_definition \
"definition title" \
"definition body content.")
$(f_definition \
"another definition title" \
"another definition body content.")
$(f_code_definition \
"code definition title" \
"code definition body content.")
$(f_code_definition \
"code definition title with some escaped html entities: <foo> & <bar>" \
"code definition body content with nested $(f_bold "bold") and $(f_code "inline code") text.")
some free text yet again.
$(f_if "terminal" "$(f_heading "conditional heading (visible only in terminal)" | f_fg_yellow)")$(f_if "markdown" "$(f_heading "conditional heading (visible only in markdown)" | f_fg_yellow)")
$(f_list_item "list item with plain text.")
$(f_list_item "another list item with plain text.")
$(f_list_item "list item with some $(f_code 'inline code') in it.")
$(f_list_item "list item with some $(f_bold 'bold text') in it.")
$(f_list_item "another list item with plain text.")
just free text.
$(f_list_item "list item title" \
"list item body content")
$(f_list_item "list item title" \
"$(f_code_block \
'code block inside a list item with no highlighting')
some list item content text, and than:
$(f_code_block \
"js" \
'console.log("code block inside a list item with javascript highlighting")')
$(f_if "terminal" "conditional content (visible only in terminal):
$(f_output \
"this is an output block
$(f_bg_blue "here is some background")
$(f_fg_rainbow "the quick brown fox jumps over the lazy dog")")")
$(f_if "markdown" "conditional content (visible only in markdown)")
")
$(f_if "terminal" "$(f_fg_blue "blue bold subheading (visible only in terminal)" | f_bold | f_subheading)")
free text at the end. yup.
"
}
main() {
local source_dir
# test if this script is executed (i.e. not sourced)
# shellcheck disable=SC2128
if [[ $BASH_SOURCE = "$0" ]]; then
# shellcheck disable=SC2164,SC2128
source_dir="$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )"
# shellcheck source=/dev/null
source "$source_dir"/formatter
output_showcase
exit 0
fi
}
main