Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muesli/marky
Generate markdown programmatically
https://github.com/muesli/marky
hacktoberfest
Last synced: about 2 months ago
JSON representation
Generate markdown programmatically
- Host: GitHub
- URL: https://github.com/muesli/marky
- Owner: muesli
- License: mit
- Created: 2020-07-22T06:17:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-22T06:41:53.000Z (over 4 years ago)
- Last Synced: 2024-10-03T12:23:25.922Z (2 months ago)
- Topics: hacktoberfest
- Language: Go
- Size: 14.6 KB
- Stars: 44
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - muesli/marky - Generate markdown programmatically (Go)
README
# marky
Generate markdown programmatically
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/muesli/marky)
[![Build Status](https://github.com/muesli/marky/workflows/build/badge.svg)](https://github.com/muesli/marky/actions)
[![Coverage Status](https://coveralls.io/repos/github/muesli/marky/badge.svg?branch=master)](https://coveralls.io/github/muesli/marky?branch=master)
[![Go ReportCard](http://goreportcard.com/badge/muesli/marky)](http://goreportcard.com/report/muesli/marky)## Usage
```go
d := NewDocument().
Add(Heading{
Caption: "This is marky",
Level: 1,
}).
Add(NewParagraph().
Add(Text{
Text: "I really like using Markdown.",
}),
).
Add(NewParagraph().
Add(Image{
Text: "An Image",
Image: "/image.png",
}),
)ioutil.WriteFile("README.md", []byte(d.String()), 0644)
```### Links
```go
d.Add(Link{
Text: "A Link",
URL: "https://a.url",
})
```### Images
```go
d.Add(Image{
Text: "An Image",
Image: "/image.png",
URL: "https://a.url",
})
```### Quotes
```go
e := Quote{}
e.Add(Text{
Text: "Dorothy followed her through many of the beautiful rooms in her castle.",
})
d.Add(e)
```### Codeblocks
```go
d.Add(Code{
Source: `echo "Hello"\necho "World"`,
Language: "bash",
})
```### Lists
```go
e := List{
Ordered: true,
}
e.Add(Text{
Text: "First Item",
}).Add(Text{
Text: "Second Item",
})
d.Add(e)
```### Tasks
```go
e := List{}
e.Add(Task{
Text: "First Task",
}).Add(Task{
Text: "Second Task",
Done: true,
})
d.Add(e)
```