mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-08-31 14:16:44 -04:00
Generate example styles from default styles
This commit is contained in:
committed by
Christian Muehlhaeuser
parent
6b9278b445
commit
bdbe6ae0c5
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/charmbracelet/glamour"
|
||||
"github.com/charmbracelet/glamour/ansi"
|
||||
)
|
||||
|
||||
func writeStyleJSON(filename string, styleConfig *ansi.StyleConfig) error {
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
e := json.NewEncoder(f)
|
||||
e.SetIndent("", " ")
|
||||
return e.Encode(styleConfig)
|
||||
}
|
||||
|
||||
func run() error {
|
||||
for style, styleConfig := range glamour.DefaultStyles {
|
||||
if err := writeStyleJSON(filepath.Join("styles", style+".json"), styleConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := run(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
# Glamour Style Guide
|
||||
|
||||
The JSON files in this directory are generated from the default styles. To
|
||||
re-generate them, run:
|
||||
|
||||
go run ./internal/generate-style-json
|
||||
|
||||
## Block Elements
|
||||
|
||||
Block elements contain other elements and are rendered around them. All block
|
||||
|
||||
+63
-57
@@ -1,9 +1,17 @@
|
||||
{
|
||||
"document": {
|
||||
"indent": 2,
|
||||
"block_prefix": "\n",
|
||||
"block_suffix": "\n",
|
||||
"color": "252"
|
||||
"color": "252",
|
||||
"indent": 2
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
},
|
||||
"paragraph": {},
|
||||
"list": {
|
||||
"level_indent": 2
|
||||
},
|
||||
"heading": {
|
||||
"block_suffix": "\n",
|
||||
@@ -13,8 +21,8 @@
|
||||
"h1": {
|
||||
"prefix": " ",
|
||||
"suffix": " ",
|
||||
"background_color": "63",
|
||||
"color": "228",
|
||||
"background_color": "63",
|
||||
"bold": true
|
||||
},
|
||||
"h2": {
|
||||
@@ -35,40 +43,6 @@
|
||||
"bold": false
|
||||
},
|
||||
"text": {},
|
||||
"list": {
|
||||
"level_indent": 2
|
||||
},
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"link_text": {
|
||||
"color": "35",
|
||||
"bold": true
|
||||
},
|
||||
"link": {
|
||||
"underline": true,
|
||||
"color": "30"
|
||||
},
|
||||
"image_text": {
|
||||
"format": "Image: {{.text}} →",
|
||||
"color": "243"
|
||||
},
|
||||
"image": {
|
||||
"underline": true,
|
||||
"color": "212"
|
||||
},
|
||||
"table": {
|
||||
"center_separator": "┼",
|
||||
"column_separator": "│",
|
||||
"row_separator": "─"
|
||||
},
|
||||
"task": {
|
||||
"unticked": "[ ] ",
|
||||
"ticked": "[✓] "
|
||||
},
|
||||
"strikethrough": {
|
||||
"crossed_out": true
|
||||
},
|
||||
@@ -79,29 +53,44 @@
|
||||
"bold": true
|
||||
},
|
||||
"hr": {
|
||||
"format": "\n--------\n",
|
||||
"color": "240"
|
||||
"color": "240",
|
||||
"format": "\n--------\n"
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
"definition_description": {
|
||||
"block_prefix": "\n🠶 "
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"task": {
|
||||
"ticked": "[✓] ",
|
||||
"unticked": "[ ] "
|
||||
},
|
||||
"link": {
|
||||
"color": "30",
|
||||
"underline": true
|
||||
},
|
||||
"link_text": {
|
||||
"color": "35",
|
||||
"bold": true
|
||||
},
|
||||
"image": {
|
||||
"color": "212",
|
||||
"underline": true
|
||||
},
|
||||
"image_text": {
|
||||
"color": "243",
|
||||
"format": "Image: {{.text}} →"
|
||||
},
|
||||
"html_block": {},
|
||||
"html_span": {},
|
||||
"code": {
|
||||
"prefix": " ",
|
||||
"suffix": " ",
|
||||
"background_color": "236",
|
||||
"color": "203"
|
||||
"color": "203",
|
||||
"background_color": "236"
|
||||
},
|
||||
"code_block": {
|
||||
"margin": 2,
|
||||
"color": "244",
|
||||
"margin": 2,
|
||||
"chroma": {
|
||||
"text": {
|
||||
"color": "#C4C4C4"
|
||||
@@ -148,18 +137,23 @@
|
||||
},
|
||||
"name_class": {
|
||||
"color": "#F1F1F1",
|
||||
"bold": true,
|
||||
"underline": true
|
||||
"underline": true,
|
||||
"bold": true
|
||||
},
|
||||
"name_constant": {},
|
||||
"name_decorator": {
|
||||
"color": "#FFFF87"
|
||||
},
|
||||
"name_exception": {},
|
||||
"name_function": {
|
||||
"color": "#00D787"
|
||||
},
|
||||
"name_other": {},
|
||||
"literal": {},
|
||||
"literal_number": {
|
||||
"color": "#6EEFC0"
|
||||
},
|
||||
"literal_date": {},
|
||||
"literal_string": {
|
||||
"color": "#C69669"
|
||||
},
|
||||
@@ -172,12 +166,12 @@
|
||||
"generic_emph": {
|
||||
"italic": true
|
||||
},
|
||||
"generic_strong": {
|
||||
"bold": true
|
||||
},
|
||||
"generic_inserted": {
|
||||
"color": "#00D787"
|
||||
},
|
||||
"generic_strong": {
|
||||
"bold": true
|
||||
},
|
||||
"generic_subheading": {
|
||||
"color": "#777777"
|
||||
},
|
||||
@@ -185,5 +179,17 @@
|
||||
"background_color": "#373737"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
"center_separator": "┼",
|
||||
"column_separator": "│",
|
||||
"row_separator": "─"
|
||||
},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
"definition_description": {
|
||||
"block_prefix": "\n🠶 "
|
||||
},
|
||||
"html_block": {},
|
||||
"html_span": {}
|
||||
}
|
||||
|
||||
+63
-57
@@ -1,9 +1,17 @@
|
||||
{
|
||||
"document": {
|
||||
"indent": 2,
|
||||
"block_prefix": "\n",
|
||||
"block_suffix": "\n",
|
||||
"color": "234"
|
||||
"color": "234",
|
||||
"indent": 2
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
},
|
||||
"paragraph": {},
|
||||
"list": {
|
||||
"level_indent": 2
|
||||
},
|
||||
"heading": {
|
||||
"block_suffix": "\n",
|
||||
@@ -13,8 +21,8 @@
|
||||
"h1": {
|
||||
"prefix": " ",
|
||||
"suffix": " ",
|
||||
"background_color": "63",
|
||||
"color": "228",
|
||||
"background_color": "63",
|
||||
"bold": true
|
||||
},
|
||||
"h2": {
|
||||
@@ -34,40 +42,6 @@
|
||||
"bold": false
|
||||
},
|
||||
"text": {},
|
||||
"list": {
|
||||
"level_indent": 2
|
||||
},
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"link_text": {
|
||||
"color": "29",
|
||||
"bold": true
|
||||
},
|
||||
"link": {
|
||||
"underline": true,
|
||||
"color": "36"
|
||||
},
|
||||
"image_text": {
|
||||
"format": "Image: {{.text}} →",
|
||||
"color": "243"
|
||||
},
|
||||
"image": {
|
||||
"underline": true,
|
||||
"color": "205"
|
||||
},
|
||||
"table": {
|
||||
"center_separator": "┼",
|
||||
"column_separator": "│",
|
||||
"row_separator": "─"
|
||||
},
|
||||
"task": {
|
||||
"unticked": "[ ] ",
|
||||
"ticked": "[✓] "
|
||||
},
|
||||
"strikethrough": {
|
||||
"crossed_out": true
|
||||
},
|
||||
@@ -78,29 +52,44 @@
|
||||
"bold": true
|
||||
},
|
||||
"hr": {
|
||||
"format": "\n--------\n",
|
||||
"color": "249"
|
||||
"color": "249",
|
||||
"format": "\n--------\n"
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
"definition_description": {
|
||||
"block_prefix": "\n🠶 "
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"task": {
|
||||
"ticked": "[✓] ",
|
||||
"unticked": "[ ] "
|
||||
},
|
||||
"link": {
|
||||
"color": "36",
|
||||
"underline": true
|
||||
},
|
||||
"link_text": {
|
||||
"color": "29",
|
||||
"bold": true
|
||||
},
|
||||
"image": {
|
||||
"color": "205",
|
||||
"underline": true
|
||||
},
|
||||
"image_text": {
|
||||
"color": "243",
|
||||
"format": "Image: {{.text}} →"
|
||||
},
|
||||
"html_block": {},
|
||||
"html_span": {},
|
||||
"code": {
|
||||
"prefix": " ",
|
||||
"suffix": " ",
|
||||
"background_color": "254",
|
||||
"color": "203"
|
||||
"color": "203",
|
||||
"background_color": "254"
|
||||
},
|
||||
"code_block": {
|
||||
"margin": 2,
|
||||
"color": "242",
|
||||
"margin": 2,
|
||||
"chroma": {
|
||||
"text": {
|
||||
"color": "#2A2A2A"
|
||||
@@ -133,6 +122,7 @@
|
||||
"punctuation": {
|
||||
"color": "#FA7878"
|
||||
},
|
||||
"name": {},
|
||||
"name_builtin": {
|
||||
"color": "#0A1BB1"
|
||||
},
|
||||
@@ -144,8 +134,8 @@
|
||||
},
|
||||
"name_class": {
|
||||
"color": "#212121",
|
||||
"bold": true,
|
||||
"underline": true
|
||||
"underline": true,
|
||||
"bold": true
|
||||
},
|
||||
"name_constant": {
|
||||
"color": "#581290"
|
||||
@@ -153,12 +143,16 @@
|
||||
"name_decorator": {
|
||||
"color": "#A3A322"
|
||||
},
|
||||
"name_exception": {},
|
||||
"name_function": {
|
||||
"color": "#019F57"
|
||||
},
|
||||
"name_other": {},
|
||||
"literal": {},
|
||||
"literal_number": {
|
||||
"color": "#22CCAE"
|
||||
},
|
||||
"literal_date": {},
|
||||
"literal_string": {
|
||||
"color": "#7E5B38"
|
||||
},
|
||||
@@ -171,12 +165,12 @@
|
||||
"generic_emph": {
|
||||
"italic": true
|
||||
},
|
||||
"generic_strong": {
|
||||
"bold": true
|
||||
},
|
||||
"generic_inserted": {
|
||||
"color": "#00D787"
|
||||
},
|
||||
"generic_strong": {
|
||||
"bold": true
|
||||
},
|
||||
"generic_subheading": {
|
||||
"color": "#777777"
|
||||
},
|
||||
@@ -184,5 +178,17 @@
|
||||
"background_color": "#373737"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
"center_separator": "┼",
|
||||
"column_separator": "│",
|
||||
"row_separator": "─"
|
||||
},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
"definition_description": {
|
||||
"block_prefix": "\n🠶 "
|
||||
},
|
||||
"html_block": {},
|
||||
"html_span": {}
|
||||
}
|
||||
|
||||
+38
-37
@@ -1,8 +1,16 @@
|
||||
{
|
||||
"document": {
|
||||
"indent": 2,
|
||||
"block_prefix": "\n",
|
||||
"block_suffix": "\n"
|
||||
"block_suffix": "\n",
|
||||
"indent": 2
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
},
|
||||
"paragraph": {},
|
||||
"list": {
|
||||
"level_indent": 4
|
||||
},
|
||||
"heading": {
|
||||
"block_suffix": "\n"
|
||||
@@ -26,30 +34,6 @@
|
||||
"prefix": "###### "
|
||||
},
|
||||
"text": {},
|
||||
"list": {
|
||||
"level_indent": 4
|
||||
},
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"link_text": {},
|
||||
"link": {},
|
||||
"image_text": {
|
||||
"format": "Image: {{.text}} →"
|
||||
},
|
||||
"image": {},
|
||||
"table": {
|
||||
"center_separator": "┼",
|
||||
"column_separator": "│",
|
||||
"row_separator": "─"
|
||||
},
|
||||
"task": {
|
||||
"unticked": "[ ] ",
|
||||
"ticked": "[✓] "
|
||||
},
|
||||
"strikethrough": {
|
||||
"block_prefix": "~~",
|
||||
"block_suffix": "~~"
|
||||
@@ -65,9 +49,33 @@
|
||||
"hr": {
|
||||
"format": "\n--------\n"
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"task": {
|
||||
"ticked": "[✓] ",
|
||||
"unticked": "[ ] "
|
||||
},
|
||||
"link": {},
|
||||
"link_text": {},
|
||||
"image": {},
|
||||
"image_text": {
|
||||
"format": "Image: {{.text}} →"
|
||||
},
|
||||
"code": {
|
||||
"block_prefix": "`",
|
||||
"block_suffix": "`"
|
||||
},
|
||||
"code_block": {
|
||||
"margin": 2
|
||||
},
|
||||
"table": {
|
||||
"center_separator": "┼",
|
||||
"column_separator": "│",
|
||||
"row_separator": "─"
|
||||
},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
@@ -75,12 +83,5 @@
|
||||
"block_prefix": "\n🠶 "
|
||||
},
|
||||
"html_block": {},
|
||||
"html_span": {},
|
||||
"code": {
|
||||
"block_prefix": "`",
|
||||
"block_suffix": "`"
|
||||
},
|
||||
"code_block": {
|
||||
"margin": 2
|
||||
}
|
||||
"html_span": {}
|
||||
}
|
||||
|
||||
+26
-24
@@ -1,5 +1,13 @@
|
||||
{
|
||||
"document": {},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "\u003e "
|
||||
},
|
||||
"paragraph": {},
|
||||
"list": {
|
||||
"level_indent": 4
|
||||
},
|
||||
"heading": {
|
||||
"block_suffix": "\n"
|
||||
},
|
||||
@@ -23,27 +31,6 @@
|
||||
"prefix": "###### "
|
||||
},
|
||||
"text": {},
|
||||
"list": {
|
||||
"level_indent": 4
|
||||
},
|
||||
"item": {
|
||||
"block_prefix": "- "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"link_text": {},
|
||||
"link": {},
|
||||
"image_text": {
|
||||
"format": "Image: {{.text}} => "
|
||||
},
|
||||
"image": {},
|
||||
"code": {
|
||||
"block_prefix": "`",
|
||||
"block_suffix": "`"
|
||||
},
|
||||
"code_block": {},
|
||||
"table": {},
|
||||
"strikethrough": {
|
||||
"block_prefix": "~~",
|
||||
"block_suffix": "~~"
|
||||
@@ -59,10 +46,25 @@
|
||||
"hr": {
|
||||
"format": "\n--------\n"
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "> "
|
||||
"item": {
|
||||
"block_prefix": "- "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"task": {},
|
||||
"link": {},
|
||||
"link_text": {},
|
||||
"image": {},
|
||||
"image_text": {
|
||||
"format": "Image: {{.text}} =\u003e "
|
||||
},
|
||||
"code": {
|
||||
"block_prefix": "`",
|
||||
"block_suffix": "`"
|
||||
},
|
||||
"code_block": {},
|
||||
"table": {},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
"definition_description": {
|
||||
|
||||
Reference in New Issue
Block a user