okami.mom/glamour

git clone https://git.nkp.pet/okami.mom/glamour

nekomimi.pettake code block text from Segments.Value and hang list items through IndentWriter052c391

main
2 folders12 files

files

examples/
gallery/
README.md10.3 KiB
ascii.json1.3 KiB
dark.json3.3 KiB
dracula.go5.0 KiB
dracula.json3.3 KiB
light.json3.3 KiB
notty.json1.3 KiB
pink.json1.3 KiB
styles.go16.8 KiB
tokyo-night.go4.9 KiB
tokyo-night.json3.2 KiB
tokyo_night.json3.2 KiB

Glamour Style Guide

The JSON files in this directory are generated from the default styles. To re-generate them, run:

go generate ..

Block Elements

Block elements contain other elements and are rendered around them. All block elements support the following style settings:

AttributeValueDescription
block_prefixstringPrinted before the block's first element (in parent's style)
block_suffixstringPrinted after the block's last element (in parent's style)
prefixstringPrinted before the block's first element
suffixstringPrinted after the block's last element
indentnumberSpecifies the indentation of the block
indent_tokenstringSpecifies the indentation format
marginnumberSpecifies the margin around the block
colorcolorDefines the default text color for the block
background_colorcolorDefines the default background color for the block

Elements inside a block inherit the block's following style settings:

AttributeValueDescription
colorcolorDefines the default text color for the block
background_colorcolorDefines the default background color for the block
boldboolIncreases text intensity
faintboolDecreases text intensity
italicboolPrints the text in italic
crossed_outboolEnables strikethrough as text decoration
underlineboolEnables underline as text decoration
overlinedboolEnables overline as text decoration
blinkboolEnables blinking text
concealboolConceals / hides the text
inverseboolSwaps fore- & background colors

document

The document element represents the markdown's body.

Example

Style:

"document": {
    "indent": 2,
    "background_color": "234",
    "block_prefix": "\n",
    "block_suffix": "\n"
}

paragraph

The paragraph element represents a paragraph in the document.

Example

Style:

"paragraph": {
    "margin": 4,
    "color": "15",
    "background_color": "235"
}

heading

The heading element represents a heading.

h1 - h6

The h1 to h6 elements represent headings. h1 defines the most important heading, h6 the least important heading. Undefined attributes are inherited from the heading element.

Example

Markdown:

# h1

## h2

### h3

Style:

"heading": {
    "color": "15",
    "background_color": "57"
},
"h1": {
    "prefix": "=> ",
    "suffix": " <=",
    "margin": 2,
    "bold": true,
    "background_color": "69"
},
"h2": {
    "prefix": "## ",
    "margin": 4
},
"h3": {
    "prefix": "### ",
    "margin": 6
}

Output:

Heading Example


block_quote

The block_quote element represents a quote.

Example

Style:

"block_quote": {
    "color": "200",
    "indent": 1,
    "indent_token": "=> "
}

Output:

Block Quote Example


list

The list element represents a list in the document.

AttributeValueDescription
level_indentnumberSpecifies the indentation for nested lists

Example

Style:

"list": {
    "color": "15",
    "background_color": "52",
    "level_indent": 4
}

code_block

The code_block element represents a block of code.

AttributeValueDescription
themestringDefines the Chroma theme used for syntax highlighting

Example

Style:

"code_block": {
    "color": "200",
    "theme": "solarized-dark"
}

Output:

Code Block Example


table

The table element represents a table of data.

Example

Markdown:

| Label  | Value |
| ------ | ----- |
| First  | foo   |
| Second | bar   |

Style:

"table": {
    "margin": 4
}

Output:

Table Example

Inline Elements

All inline elements support the following style settings:

AttributeValueDescription
block_prefixstringPrinted before the element (in parent's style)
block_suffixstringPrinted after the element (in parent's style)
prefixstringPrinted before the element
suffixstringPrinted after the element
colorcolorDefines the default text color for the document
background_colorcolorDefines the default background color for the document
boldboolIncreases text intensity
faintboolDecreases text intensity
italicboolPrints the text in italic
crossed_outboolEnables strikethrough as text decoration
underlineboolEnables underline as text decoration
overlinedboolEnables overline as text decoration
blinkboolEnables blinking text
concealboolConceals / hides the text
inverseboolSwaps fore- & background colors

text

The text element represents a block of text.

Example

Style:

"text": {
    "bold": true,
    "color": "15",
    "background_color": "57"
}

item

The item element represents an item in a list.

Example

Markdown:

- First Item
    - Nested List Item
- Second Item

Style:

"item": {
    "block_prefix": "• "
}

Output:

List Example


enumeration

The enumeration element represents an item in an ordered list.

Example

Markdown:

1. First Item
2. Second Item

Style:

"enumeration": {
    "block_prefix": ". "
}

Output:

Enumeration Example


task

The task element represents a task item.

AttributeValueDescription
tickedstringPrefix for finished tasks
untickedstringPrefix for unfinished tasks

Example

Markdown:

- [x] Finished Task
- [ ] Outstanding Task

Style:

"task": {
    "ticked": "✓ ",
    "unticked": "✗ "
}

Output:

Task Example


link

The link element represents a link.

Example

Markdown:

This is a [link](https://charm.sh).

Style:

"link": {
    "color": "123",
    "underline": true,
    "block_prefix": "(",
    "block_suffix": ")"
}

Output:

Link Example


link_text

The link_text element represents the text associated with a link.

Example

Style:

"link_text": {
    "color": "123",
    "bold": true
}

image

The image element represents an image.

Example

Markdown:

![Image](https://charm.sh/logo.png).

Style:

"image": {
    "color": "123",
    "block_prefix": "[Image: ",
    "block_suffix": "]"
}

Output:

Image Example


image_text

The image_text element represents the text associated with an image.

Example

Style:

"image_text": {
    "color": "8"
}

code

The code element represents an inline code segment.

Example

Style:

"code": {
    "color": "200"
}

Output:

Code Example


emph

The emph element represents an emphasized text.

Example

Markdown:

This text is *emphasized*.

Style:

"emph": {
    "italic": true
}

Output:

Emph Example


strong

The strong element represents important text.

Example

Markdown:

This text is **strong**.

Style:

"strong": {
    "bold": true
}

Output:

Strong Example


strikethrough

The strikethrough element represents strikethrough text.

Example

Markdown:

~~Scratch this~~.

Style:

"strikethrough": {
    "crossed_out": true
}

Output:

Strikethrough Example


hr

The hr element represents a horizontal rule.

Example

Markdown:

---

Style:

"hr": {
    "block_prefix": "---"
}

html_block

html_span