https://github.com/jiro4989/markup-table
A package for generating tables of markup languages in Go.
https://github.com/jiro4989/markup-table
golang library markup package
Last synced: 8 days ago
JSON representation
A package for generating tables of markup languages in Go.
- Host: GitHub
- URL: https://github.com/jiro4989/markup-table
- Owner: jiro4989
- Created: 2019-08-02T12:32:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-02T21:14:04.000Z (almost 7 years ago)
- Last Synced: 2025-10-29T06:39:38.304Z (8 months ago)
- Topics: golang, library, markup, package
- Language: Go
- Homepage: https://godoc.org/github.com/jiro4989/markup-table
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# markup-table
[](https://travis-ci.org/jiro4989/markup-table)
`markup-table` is a package for generating tables of markup languages.
## Installation
```bash
go get github.com/jiro4989/markup-table
```
## Usage examples
```go
package table_test
import (
"fmt"
table "github.com/jiro4989/markup-table"
)
func ExampleMarkdown() {
matrix := [][]string{
{"Head 1", "Head 2", "Head 3"},
{"Body 1", "Body 2", "Body 3"},
{"Body 4", "Body 5", "Body 6"},
}
for _, row := range table.Markdown(matrix) {
fmt.Println(row)
}
// Output:
// | Head 1 | Head 2 | Head 3 |
// | :---: | :---: | :---: |
// | Body 1 | Body 2 | Body 3 |
// | Body 4 | Body 5 | Body 6 |
}
func ExampleHTML() {
matrix := [][]string{
{"Head 1", "Head 2", "Head 3"},
{"Body 1", "Body 2", "Body 3"},
{"Body 4", "Body 5", "Body 6"},
}
for _, row := range table.HTML(matrix) {
fmt.Println(row)
}
// Output:
// ,
// ,
// Head 1Head 2Head 3,
// ,
// ,
// Body 1Body 2Body 3,
// Body 4Body 5Body 6,
// ,
// ,
}
func ExampleAsciidoc() {
matrix := [][]string{
{"Head 1", "Head 2", "Head 3"},
{"Body 1", "Body 2", "Body 3"},
{"Body 4", "Body 5", "Body 6"},
}
for _, row := range table.Asciidoc(matrix) {
fmt.Println(row)
}
// Output:
// [options=header],
// |=================,
// | Head 1 | Head 2 | Head 3,
// | Body 1 | Body 2 | Body 3,
// | Body 4 | Body 5 | Body 6,
// |=================,
}
```
## Documentations
* [markup-table - godoc](https://godoc.org/github.com/jiro4989/markup-table)