diff --git a/README.md b/README.md
index 099b9a9..93bcbda 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,32 @@ converter.Use(plugin.Strikethrough(""))
For more information have a look at the example [github_flavored](/examples/github_flavored/main.go).
+---
+
+These are the plugins located in the [plugin folder](/plugin) which you can use by importing "github.com/JohannesKaufmann/html-to-markdown/plugin".
+
+| Name | Description |
+| --------------------- | ------------------------------------------------------------------------------------------- |
+| GitHubFlavored | GitHub's Flavored Markdown contains `TaskListItems`, `Strikethrough` and `Table`. |
+| TaskListItems | (Included in `GitHubFlavored`). Converts `` checkboxes into `- [x] Task`. |
+| Strikethrough | (Included in `GitHubFlavored`). Converts ``, ``, and `` to the `~~` syntax. |
+| Table | (Included in `GitHubFlavored`). Convert a `
` into something like this... |
+| TableCompat | |
+| | |
+| VimeoEmbed | |
+| YoutubeEmbed | |
+| | |
+| ConfluenceCodeBlock | Converts `` elements that are used in Atlassian’s Wiki "Confluence". |
+| ConfluenceAttachments | Converts `` elements. |
+
+These are the plugins in other repositories:
+
+| Name | Description |
+| ---------------------------- | ------------------- |
+| \[Plugin Name\]\(Your Link\) | A short description |
+
+I you write a plugin, feel free to open a PR that adds your Plugin to this list.
+
## Writing Plugins
Have a look at the [plugin folder](/plugin) for a reference implementation. The most basic one is [Strikethrough](/plugin/strikethrough.go).
diff --git a/plugin/vimeo.go b/plugin/iframe_vimeo.go
similarity index 97%
rename from plugin/vimeo.go
rename to plugin/iframe_vimeo.go
index 186301f..1c9c32e 100644
--- a/plugin/vimeo.go
+++ b/plugin/iframe_vimeo.go
@@ -54,9 +54,9 @@ const (
VimeoWithDescription
)
-// EXPERIMENTALVimeoEmbed registers a rule (for iframes) and
+// VimeoEmbed registers a rule (for iframes) and
// returns a markdown compatible representation (link to video, ...).
-func EXPERIMENTALVimeoEmbed(variation vimeoVariation) md.Plugin {
+func VimeoEmbed(variation vimeoVariation) md.Plugin {
return func(c *md.Converter) []md.Rule {
getVimeoData := func(id string) (*vimeoVideo, error) {
u := fmt.Sprintf("http://vimeo.com/api/oembed.json?url=https://vimeo.com/%s", id)
diff --git a/plugin/iframe_youtube.go b/plugin/iframe_youtube.go
new file mode 100644
index 0000000..fedf63a
--- /dev/null
+++ b/plugin/iframe_youtube.go
@@ -0,0 +1,40 @@
+package plugin
+
+import (
+ "fmt"
+ "regexp"
+ "strings"
+
+ md "github.com/JohannesKaufmann/html-to-markdown"
+ "github.com/PuerkitoBio/goquery"
+)
+
+var youtubeID = regexp.MustCompile(`youtube\.com\/embed\/([^\&\?\/]+)`)
+
+// YoutubeEmbed registers a rule (for iframes) and
+// returns a markdown compatible representation (link to video, ...).
+func YoutubeEmbed() md.Plugin {
+ return func(c *md.Converter) []md.Rule {
+ return []md.Rule{
+ {
+ Filter: []string{"iframe"},
+ Replacement: func(content string, selec *goquery.Selection, opt *md.Options) *string {
+ src := selec.AttrOr("src", "")
+ if !strings.Contains(src, "youtube.com") {
+ return nil
+ }
+ alt := selec.AttrOr("title", "")
+
+ parts := youtubeID.FindStringSubmatch(src)
+ if len(parts) != 2 {
+ return nil
+ }
+ id := parts[1]
+
+ text := fmt.Sprintf("[![%s](https://img.youtube.com/vi/%s/0.jpg)](https://www.youtube.com/watch?v=%s)", alt, id, id)
+ return &text
+ },
+ },
+ }
+ }
+}
diff --git a/plugin/table.go b/plugin/table.go
index 21a5102..e5fcadd 100644
--- a/plugin/table.go
+++ b/plugin/table.go
@@ -8,7 +8,7 @@ import (
"github.com/PuerkitoBio/goquery"
)
-// TableCompat is a compatibility plugon for environments where
+// TableCompat is a compatibility plugin for environments where
// only commonmark markdown (without Tables) is supported.
//
// Note: In an environment that supports "real" Tables, like GitHub's Flavored Markdown
@@ -132,10 +132,10 @@ func Table() md.Plugin {
}
// A tr is a heading row if:
-// - the parent is a THEAD
-// - or if its the first child of the TABLE or the first TBODY (possibly
-// following a blank THEAD)
-// - and every cell is a TH
+// - the parent is a THEAD
+// - or if its the first child of the TABLE or the first TBODY (possibly
+// following a blank THEAD)
+// - and every cell is a TH
func isHeadingRow(s *goquery.Selection) bool {
parent := s.Parent()
diff --git a/plugin/youtube.go b/plugin/youtube.go
deleted file mode 100644
index 1566478..0000000
--- a/plugin/youtube.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package plugin
-
-import (
- "fmt"
- "regexp"
- "strings"
-
- md "github.com/JohannesKaufmann/html-to-markdown"
- "github.com/PuerkitoBio/goquery"
-)
-
-var youtubeID = regexp.MustCompile(`youtube\.com\/embed\/([^\&\?\/]+)`)
-
-// EXPERIMENTALYoutubeEmbed registers a rule (for iframes) and
-// returns a markdown compatible representation (link to video, ...).
-var EXPERIMENTALYoutubeEmbed = []md.Rule{
- {
- Filter: []string{"iframe"},
- Replacement: func(content string, selec *goquery.Selection, opt *md.Options) *string {
- src := selec.AttrOr("src", "")
- if !strings.Contains(src, "youtube.com") {
- return nil
- }
- alt := selec.AttrOr("title", "")
-
- parts := youtubeID.FindStringSubmatch(src)
- if len(parts) != 2 {
- return nil
- }
- id := parts[1]
-
- text := fmt.Sprintf("[![%s](https://img.youtube.com/vi/%s/0.jpg)](https://www.youtube.com/watch?v=%s)", alt, id, id)
- return &text
- },
- },
-}