# README
goldmark-embed
goldmark-embed is based on 13rac1's extension for the goldmark library that extends
the Markdown ![]()
image embed syntax to support additional media formats.
Supports YouTube and Vimeo links.
Demo
This markdown:
# Hello goldmark-embed for YouTube

# Hello goldmark-embed for Vimeo

Becomes this HTML:
<h1>Hello goldmark-embed for Youtube</h1>
<p><iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<h1>Hello goldmark-embed for Vimeo</h1>
<p><iframe src="https://player.vimeo.com/video/148751763?&badge=0&autopause=0&player_id=0&app_id=58479" width="724" height="404" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe></p>
Installation
go get github.com/PaperPrototype/goldmark-embed
Usage
markdown := goldmark.New(
goldmark.WithExtensions(
embed.New(),
),
)
var buf bytes.Buffer
if err := markdown.Convert([]byte(source), &buf); err != nil {
panic(err)
}
// output html
fmt.Print(buf)
}
TODO
- Embed Options
- Additional Data Sources
License
MIT
Authors
# Functions
New returns a new Embed extension.
NewHTMLRenderer builds a new HTMLRenderer with given options and returns it.
New Vimeo returns a new Vimeo node.
NewYouTube returns a new YouTube node.
# Variables
KindVimeo is a NodeKind of the Vimeo node.
KindYouTube is a NodeKind of the YouTube node.
# Structs
HTMLRenderer struct is a renderer.NodeRenderer implementation for the extension.
Vimeo struct represents a Vimeo Video embed of the markdown text.
YouTube struct represents a YouTube Video embed of the Markdown text.
# Type aliases
Option is a functional option type for this extension.