# README
go-term-markdown
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 support
Note: this renderer is packaged as a standalone terminal viewer at https://github.com/MichaelMure/mdr/
Usage
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 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 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
# Functions
Extensions returns the bitmask of extensions supported by this renderer.
NewRenderer creates a new instance of the console renderer.
No description provided by the author
Use a custom collection of ANSI colors for the blockquotes.
Use a custom collection of ANSI colors for the headings.
Dithering mode for ansimage Default is fine directly through a terminal DitheringWithBlocks is recommended if a terminal UI library is used.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
CurrentTheme sets the theme to use to color code blocks.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
DitheringMode type is used for image scale dithering mode constants.
No description provided by the author