https://github.com/michaelmure/go-term-markdown
A markdown renderer package for the terminal
https://github.com/michaelmure/go-term-markdown
Last synced: 22 days ago
JSON representation
A markdown renderer package for the terminal
- Host: GitHub
- URL: https://github.com/michaelmure/go-term-markdown
- Owner: MichaelMure
- License: mit
- Created: 2019-07-17T19:06:53.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-22T02:17:27.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T12:09:34.728Z (30 days ago)
- Language: Go
- Size: 2.03 MB
- Stars: 277
- Watchers: 5
- Forks: 35
- Open Issues: 24
-
Metadata Files:
- Readme: Readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# go-term-markdown
[](https://travis-ci.com/MichaelMure/go-term-markdown)
[](https://godoc.org/github.com/MichaelMure/go-term-markdown)
[](https://goreportcard.com/report/github.com/MichaelMure/go-term-markdown)
[](https://codecov.io/gh/MichaelMure/go-term-markdown)
[](https://github.com/MichaelMure/go-term-markdown/blob/master/LICENSE)
[](https://gitter.im/the-git-bug/Lobby)`go-term-markdown` is a go package implementing a Markdown renderer for the terminal.
Note: Markdown being originally designed to render as HTML, rendering in a terminal is occasionally challenging and some adaptation had to be made.
Features:
- formatting
- lists
- tables
- images
- code blocks with syntax highlighting
- basic HTML supportNote: this renderer is packaged as a standalone terminal viewer at https://github.com/MichaelMure/mdr/
## Usage
```go
import (
"fmt"
"io/ioutil"markdown "github.com/MichaelMure/go-term-markdown"
)func main() {
path := "Readme.md"
source, err := ioutil.ReadFile(path)
if err != nil {
panic(err)
}result := markdown.Render(string(source), 80, 6)
fmt.Println(result)
}
```## Example
Here is the [Readme](https://github.com/MichaelMure/go-term-text/blob/v0.2.4/Readme.md) of `go-term-text` rendered with `go-term-markdown`:

Here is an example of table rendering:

## Origin
This package has been extracted from the [git-bug](https://github.com/MichaelMure/git-bug) project. As such, its aim is to support this project and not to provide an all-in-one solution. Contributions or full-on takeover as welcome though.
## Contribute
PRs accepted.
## License
MIT