• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..09-Apr-2021-

examples/H03-May-2022-200165

gallery/H03-May-2022-168

README.mdH A D09-Apr-202110.3 KiB566380

ascii.jsonH A D09-Apr-20211.3 KiB8887

dark.jsonH A D09-Apr-20213.4 KiB196195

light.jsonH A D09-Apr-20213.4 KiB195194

notty.jsonH A D09-Apr-20211.4 KiB8887

README.md

1# Glamour Style Guide
2
3The JSON files in this directory are generated from the default styles. To
4re-generate them, run:
5
6    go generate ..
7
8## Block Elements
9
10Block elements contain other elements and are rendered around them. All block
11elements support the following style settings:
12
13| Attribute        | Value  | Description                                                  |
14| ---------------- | ------ | ------------------------------------------------------------ |
15| block_prefix     | string | Printed before the block's first element (in parent's style) |
16| block_suffix     | string | Printed after the block's last element (in parent's style)   |
17| prefix           | string | Printed before the block's first element                     |
18| suffix           | string | Printed after the block's last element                       |
19| indent           | number | Specifies the indentation of the block                       |
20| indent_token     | string | Specifies the indentation format                             |
21| margin           | number | Specifies the margin around the block                        |
22| color            | color  | Defines the default text color for the block                 |
23| background_color | color  | Defines the default background color for the block           |
24
25Elements inside a block inherit the block's following style settings:
26
27| Attribute        | Value | Description                                        |
28| ---------------- | ----- | -------------------------------------------------- |
29| color            | color | Defines the default text color for the block       |
30| background_color | color | Defines the default background color for the block |
31| bold             | bool  | Increases text intensity                           |
32| faint            | bool  | Decreases text intensity                           |
33| italic           | bool  | Prints the text in italic                          |
34| crossed_out      | bool  | Enables strikethrough as text decoration           |
35| underline        | bool  | Enables underline as text decoration               |
36| overlined        | bool  | Enables overline as text decoration                |
37| blink            | bool  | Enables blinking text                              |
38| conceal          | bool  | Conceals / hides the text                          |
39| inverse          | bool  | Swaps fore- & background colors                    |
40
41### document
42
43The `document` element represents the markdown's body.
44
45#### Example
46
47Style:
48
49```json
50"document": {
51    "indent": 2,
52    "background_color": "234",
53    "block_prefix": "\n",
54    "block_suffix": "\n"
55}
56```
57
58---
59
60### paragraph
61
62The `paragraph` element represents a paragraph in the document.
63
64#### Example
65
66Style:
67
68```json
69"paragraph": {
70    "margin": 4,
71    "color": "15",
72    "background_color": "235"
73}
74```
75
76---
77
78### heading
79
80The `heading` element represents a heading.
81
82### h1 - h6
83
84The `h1` to `h6` elements represent headings. `h1` defines the most important
85heading, `h6` the least important heading. Undefined attributes are inherited
86from the `heading` element.
87
88#### Example
89
90Markdown:
91
92```markdown
93# h1
94
95## h2
96
97### h3
98```
99
100Style:
101
102```json
103"heading": {
104    "color": "15",
105    "background_color": "57"
106},
107"h1": {
108    "prefix": "=> ",
109    "suffix": " <=",
110    "margin": 2,
111    "bold": true,
112    "background_color": "69"
113},
114"h2": {
115    "prefix": "## ",
116    "margin": 4
117},
118"h3": {
119    "prefix": "### ",
120    "margin": 6
121}
122```
123
124Output:
125
126![Heading Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/heading.png)
127
128---
129
130### block_quote
131
132The `block_quote` element represents a quote.
133
134#### Example
135
136Style:
137
138```json
139"block_quote": {
140    "color": "200",
141    "indent": 1,
142    "indent_token": "=> "
143}
144```
145
146Output:
147
148![Block Quote Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/block_quote.png)
149
150---
151
152### list
153
154The `list` element represents a list in the document.
155
156| Attribute    | Value  | Description                                |
157| ------------ | ------ | ------------------------------------------ |
158| level_indent | number | Specifies the indentation for nested lists |
159
160#### Example
161
162Style:
163
164```json
165"list": {
166    "color": "15",
167    "background_color": "52",
168    "level_indent": 4
169}
170```
171
172---
173
174### code_block
175
176The `code_block` element represents a block of code.
177
178| Attribute | Value  | Description                                                     |
179| --------- | ------ | --------------------------------------------------------------- |
180| theme     | string | Defines the [Chroma][chroma] theme used for syntax highlighting |
181
182[chroma]: https://github.com/alecthomas/chroma
183
184#### Example
185
186Style:
187
188```json
189"code_block": {
190    "color": "200",
191    "theme": "solarized-dark"
192}
193```
194
195Output:
196
197![Code Block Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/code_block.png)
198
199---
200
201### table
202
203The `table` element represents a table of data.
204
205#### Example
206
207Markdown:
208
209```markdown
210| Label  | Value |
211| ------ | ----- |
212| First  | foo   |
213| Second | bar   |
214```
215
216Style:
217
218```json
219"table": {
220    "margin": 4
221}
222```
223
224Output:
225
226![Table Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/table.png)
227
228## Inline Elements
229
230All inline elements support the following style settings:
231
232| Attribute        | Value  | Description                                           |
233| ---------------- | ------ | ----------------------------------------------------- |
234| block_prefix     | string | Printed before the element (in parent's style)        |
235| block_suffix     | string | Printed after the element (in parent's style)         |
236| prefix           | string | Printed before the element                            |
237| suffix           | string | Printed after the element                             |
238| color            | color  | Defines the default text color for the document       |
239| background_color | color  | Defines the default background color for the document |
240| bold             | bool   | Increases text intensity                              |
241| faint            | bool   | Decreases text intensity                              |
242| italic           | bool   | Prints the text in italic                             |
243| crossed_out      | bool   | Enables strikethrough as text decoration              |
244| underline        | bool   | Enables underline as text decoration                  |
245| overlined        | bool   | Enables overline as text decoration                   |
246| blink            | bool   | Enables blinking text                                 |
247| conceal          | bool   | Conceals / hides the text                             |
248| inverse          | bool   | Swaps fore- & background colors                       |
249
250### text
251
252The `text` element represents a block of text.
253
254#### Example
255
256Style:
257
258```json
259"text": {
260    "bold": true,
261    "color": "15",
262    "background_color": "57"
263}
264```
265
266---
267
268### item
269
270The `item` element represents an item in a list.
271
272#### Example
273
274Markdown:
275
276```markdown
277- First Item
278    - Nested List Item
279- Second Item
280```
281
282Style:
283
284```json
285"item": {
286    "block_prefix": "• "
287}
288```
289
290Output:
291
292![List Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/list.png)
293
294---
295
296### enumeration
297
298The `enumeration` element represents an item in an ordered list.
299
300#### Example
301
302Markdown:
303
304```markdown
3051. First Item
3062. Second Item
307```
308
309Style:
310
311```json
312"enumeration": {
313    "block_prefix": ". "
314}
315```
316
317Output:
318
319![Enumeration Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/enumeration.png)
320
321---
322
323### task
324
325The `task` element represents a task item.
326
327| Attribute | Value  | Description                 |
328| --------- | ------ | --------------------------- |
329| ticked    | string | Prefix for finished tasks   |
330| unticked  | string | Prefix for unfinished tasks |
331
332#### Example
333
334Markdown:
335
336```markdown
337- [x] Finished Task
338- [ ] Outstanding Task
339```
340
341Style:
342
343```json
344"task": {
345    "ticked": "✓ ",
346    "unticked": "✗ "
347}
348```
349
350Output:
351
352![Task Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/task.png)
353
354---
355
356### link
357
358The `link` element represents a link.
359
360#### Example
361
362Markdown:
363
364```markdown
365This is a [link](https://charm.sh).
366```
367
368Style:
369
370```json
371"link": {
372    "color": "123",
373    "underline": true,
374    "block_prefix": "(",
375    "block_suffix": ")"
376}
377```
378
379Output:
380
381![Link Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/link.png)
382
383---
384
385### link_text
386
387The `link_text` element represents the text associated with a link.
388
389#### Example
390
391Style:
392
393```json
394"link_text": {
395    "color": "123",
396    "bold": true
397}
398```
399
400---
401
402### image
403
404The `image` element represents an image.
405
406#### Example
407
408Markdown:
409
410```markdown
411![Image](https://charm.sh/logo.png).
412```
413
414Style:
415
416```json
417"image": {
418    "color": "123",
419    "block_prefix": "[Image: ",
420    "block_suffix": "]"
421}
422```
423
424Output:
425
426![Image Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/image.png)
427
428---
429
430### image_text
431
432The `image_text` element represents the text associated with an image.
433
434#### Example
435
436Style:
437
438```json
439"image_text": {
440    "color": "8"
441}
442```
443
444---
445
446### code
447
448The `code` element represents an inline code segment.
449
450#### Example
451
452Style:
453
454```json
455"code": {
456    "color": "200"
457}
458```
459
460Output:
461
462![Code Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/code.png)
463
464---
465
466### emph
467
468The `emph` element represents an emphasized text.
469
470#### Example
471
472Markdown:
473
474```markdown
475This text is *emphasized*.
476```
477
478Style:
479
480```json
481"emph": {
482    "italic": true
483}
484```
485
486Output:
487
488![Emph Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/emph.png)
489
490---
491
492### strong
493
494The `strong` element represents important text.
495
496#### Example
497
498Markdown:
499
500```markdown
501This text is **strong**.
502```
503
504Style:
505
506```json
507"strong": {
508    "bold": true
509}
510```
511
512Output:
513
514![Strong Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/strong.png)
515
516---
517
518### strikethrough
519
520The `strikethrough` element represents strikethrough text.
521
522#### Example
523
524Markdown:
525
526```markdown
527~~Scratch this~~.
528```
529
530Style:
531
532```json
533"strikethrough": {
534    "crossed_out": true
535}
536```
537
538Output:
539
540![Strikethrough Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/strikethrough.png)
541
542---
543
544### hr
545
546The `hr` element represents a horizontal rule.
547
548#### Example
549
550Markdown:
551
552```markdown
553---
554```
555
556Style:
557
558```json
559"hr": {
560    "block_prefix": "---"
561}
562```
563
564## html_block
565## html_span
566