Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve haskell example (thanks @imcotton) #341

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading