Skip to content

13rac1/goldmark-embed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goldmark-embed

goldmark-embed is an extension for the goldmark library that extends the Markdown ![]() image embed syntax to support additional media formats.

YouTube only at first.

Demo

This markdown:

# Hello goldmark-embed

![](https://www.youtube.com/watch?v=dQw4w9WgXcQ)

Becomes this HTML:

<h1>Hello goldmark-embed</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>

Installation

go get github.com/13rac1/goldmark-embed

Usage

  markdown := goldmark.New(
    goldmark.WithExtensions(
      embed.Embed,
    ),
  )
  var buf bytes.Buffer
  if err := markdown.Convert([]byte(source), &buf); err != nil {
    panic(err)
  }
  fmt.Print(buf)
}

TODO

  • Embed Options
  • Additional Data Sources

License

MIT

Author

Brad Erickson

About

A Video embed extension for the goldmark markdown parser.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages