Skip to content

Commit

Permalink
docs: improve haskell example (thanks @imcotton)
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Aug 26, 2024
1 parent 4c01593 commit 1399ca3
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
*.golden linguist-generated
styles/gallery/auto.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/dark.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/dracula.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/light.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/notty.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/pink.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/tokyo-night.png filter=lfs diff=lfs merge=lfs -text
styles/gallery/ascii.png filter=lfs diff=lfs merge=lfs -text
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

Stylesheet-based markdown rendering for your CLI apps.

![Glamour dark style example](https://stuff.charm.sh/glamour/glamour-example.png)
<img width="845" src="https://github.com/user-attachments/assets/ec2ead40-c467-48cc-b6a8-f0f13709eeab" alt="Glamour example">

`glamour` lets you render [markdown](https://en.wikipedia.org/wiki/Markdown)
documents & templates on [ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code)
Expand Down Expand Up @@ -59,15 +59,17 @@ You can find all available default styles in our [gallery](https://github.com/ch
Want to create your own style? [Learn how!](https://github.com/charmbracelet/glamour/tree/master/styles)

There are a few options for using a custom style:

1. Call `glamour.Render(inputText, "desiredStyle")`
1. Set the `GLAMOUR_STYLE` environment variable to your desired default style or a file location for a style and call `glamour.RenderWithEnvironmentConfig(inputText)`
1. Set the `GLAMOUR_STYLE` environment variable and pass `glamour.WithEnvironmentConfig()` to your custom renderer

## Glamourous Projects

Check out these projects, which use `glamour`:

- [Glow](https://github.com/charmbracelet/glow), a markdown renderer for
the command-line.
the command-line.
- [GitHub CLI](https://github.com/cli/cli), GitHub’s official command line tool.
- [GitLab CLI](https://gitlab.com/gitlab-org/cli), GitLab's official command line tool.
- [Gitea CLI](https://gitea.com/gitea/tea), Gitea's official command line tool.
Expand All @@ -77,15 +79,15 @@ the command-line.

We’d love to hear your thoughts on this project. Feel free to drop us a note!

* [Twitter](https://twitter.com/charmcli)
* [The Fediverse](https://mastodon.social/@charmcli)
* [Discord](https://charm.sh/chat)
- [Twitter](https://twitter.com/charmcli)
- [The Fediverse](https://mastodon.social/@charmcli)
- [Discord](https://charm.sh/chat)

## License

[MIT](https://github.com/charmbracelet/glamour/raw/master/LICENSE)

***
---

Part of [Charm](https://charm.sh).

Expand Down
11 changes: 5 additions & 6 deletions examples/artichokes/artichokes.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ Remember that to compile Haskell you’ll need `ghc`.
```haskell
module Main where

import Data.Function ( (&) )
import Data.List ( intercalculate )
import Data.List (intercalate)

hello :: String -> String
hello s =
"Hello, " ++ s ++ "."
hello s = "Hello, " <> s <> "."

main :: IO ()
main =
map hello [ "artichoke", "alcachofa" ] & intercalculate "\n" & putStrLn
main = putStrLn
$ intercalate "\n"
$ hello <$> [ "artichoke", "alcachofa" ]
```

***
Expand Down
Binary file modified styles/gallery/ascii.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/auto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/dracula.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/notty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/pink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified styles/gallery/tokyo-night.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions testdata/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ Remember that to compile Haskell you’ll need `ghc`.
```haskell
module Main where

import Data.Function ( (&) )
import Data.List ( intercalculate )
import Data.List (intercalate)

hello :: String -> String
hello s =
"Hello, " ++ s ++ "."
hello s = "Hello, " <> s <> "."

main :: IO ()
main =
map hello [ "artichoke", "alcachofa" ] & intercalculate "\n" & putStrLn
main = putStrLn
$ intercalate "\n"
$ hello <$> [ "artichoke", "alcachofa" ]
```

***
Expand Down

0 comments on commit 1399ca3

Please sign in to comment.