Gum format allows you to format different text into human readable output.
Four different parse-able formats exist:
Render any input as markdown text. This uses Glamour behind the scenes.
You can pass input as lines directly as arguments to the command invocation or
pass markdown over stdin
.
gum format --type markdown < README.md
# Or, directly as arguments (useful for quick lists)
gum format --type markdown -- "# Gum Formats" "- Markdown" "- Code" "- Template" "- Emoji"
Render any code snippet with syntax highlighting. Glamour, which uses Chroma under the hood, handles styling.
Similarly to the markdown
format, code
can take input over stdin
.
cat options.go | gum format --type code
Render styled input from a string template. Templating is handled by Termenv.
gum format --type template '{{ Bold "Tasty" }} {{ Italic "Bubble" }} {{ Color "99" "0" " Gum " }}'
# Or, via stdin
echo '{{ Bold "Tasty" }} {{ Italic "Bubble" }} {{ Color "99" "0" " Gum " }}' | gum format --type template
Parse and render emojis from their matching :name:
s. Powered by
Glamour and Goldmark
Emoji
gum format --type emoji 'I :heart: Bubble Gum :candy:'
# You know the drill, also via stdin
echo 'I :heart: Bubble Gum :candy:' | gum format --type emoji
Tables are rendered using Glamour.
Bubble Gum Flavor | Price |
---|---|
Strawberry | $0.99 |
Cherry | $0.50 |
Banana | $0.75 |
Orange | $0.25 |
Lemon | $0.50 |
Lime | $0.50 |
Grape | $0.50 |
Watermelon | $0.50 |
Pineapple | $0.50 |
Blueberry | $0.50 |
Raspberry | $0.50 |
Cranberry | $0.50 |
Peach | $0.50 |
Apple | $0.50 |
Mango | $0.50 |
Pomegranate | $0.50 |
Coconut | $0.50 |
Cinnamon | $0.50 |