Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moul/mdcodec
convert Go structures to and from readable Markdown (codec).
https://github.com/moul/mdcodec
codec markdown
Last synced: 10 days ago
JSON representation
convert Go structures to and from readable Markdown (codec).
- Host: GitHub
- URL: https://github.com/moul/mdcodec
- Owner: moul
- Created: 2023-08-17T12:48:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-18T01:57:37.000Z (over 1 year ago)
- Last Synced: 2024-12-26T11:04:38.643Z (16 days ago)
- Topics: codec, markdown
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ccamel - moul/mdcodec - convert Go structures to and from readable Markdown (codec). (Go)
README
# Mdcodec
Transform Go structures into readable Markdown, tailored for both human and machine consumption.
## Features
- Hierarchical struct representation using `#` for primary and nested lists for secondary structures.
- Uses reflection.## Roadmap
- Introduce concise single-line encodings.
- Introduce markdown table support (See [moul/mdtable](https://github.com/moul/mdtable)).
- Integrate native support within Amino.
- Examples: develop markdown-centric APIs in Gnoland contracts. And Go clients.## Examples
### `mdcodec.`Marshal``
```go
type Person struct {
Name string `md:"title"`
Age int
Address struct {
City string
State string
}
}p := Person{}
p.Name = "John Doe"
p.Age = 30
p.Address.City = "Sprintfield"
p.Address.State = "IL"md := mdcodec.Marshal(p)
fmt.Println(md)// Output:
// # John Doe (Person)
//
// - **Age**: 30
// - **Address**:
// - **City**: Springfield
// - **State**: IL
```### `mdcodec.Unmarshal`
```go
var p Person
err := mdcodec.Unmarshal(md, &p)
```## 🔧 Installation
go get moul.io/mdcodec