Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MichaelMure/go-term-markdown
A markdown renderer package for the terminal
https://github.com/MichaelMure/go-term-markdown
Last synced: 3 months 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 (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-22T02:17:27.000Z (over 1 year ago)
- Last Synced: 2024-10-22T22:52:27.709Z (3 months ago)
- Language: Go
- Size: 2.03 MB
- Stars: 273
- Watchers: 6
- Forks: 33
- Open Issues: 23
-
Metadata Files:
- Readme: Readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesomeLibrary - go-term-markdown - A markdown renderer package for the terminal (语言资源库 / go)
README
# go-term-markdown
[![Build Status](https://travis-ci.com/MichaelMure/go-term-markdown.svg?branch=master)](https://travis-ci.com/MichaelMure/go-term-markdown)
[![GoDoc](https://godoc.org/github.com/MichaelMure/go-term-markdown?status.svg)](https://godoc.org/github.com/MichaelMure/go-term-markdown)
[![Go Report Card](https://goreportcard.com/badge/github.com/MichaelMure/go-term-markdown)](https://goreportcard.com/report/github.com/MichaelMure/go-term-markdown)
[![codecov](https://codecov.io/gh/MichaelMure/go-term-markdown/branch/master/graph/badge.svg)](https://codecov.io/gh/MichaelMure/go-term-markdown)
[![GitHub license](https://img.shields.io/github/license/MichaelMure/go-term-markdown.svg)](https://github.com/MichaelMure/go-term-markdown/blob/master/LICENSE)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](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`:
![rendering example](misc/result.png)
Here is an example of table rendering:
![table rendering](misc/table.png)
## 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