diff options
| author | Tong Sun <[email protected]> | 2020-07-26 17:05:07 -0400 |
|---|---|---|
| committer | Tong Sun <[email protected]> | 2020-07-26 17:05:07 -0400 |
| commit | a5af244c2507a367a8e62c2c81fe6fff71e7dddd (patch) | |
| tree | 4f6959659f120bcbdf446e7bc9de01c77f7db525 | |
| parent | - [+] pkg md options handling functionality implemented (diff) | |
| download | html2md-a5af244c2507a367a8e62c2c81fe6fff71e7dddd.tar.xz html2md-a5af244c2507a367a8e62c2c81fe6fff71e7dddd.zip | |
- [+] pkg md plugin handling functionality implemented
| -rw-r--r-- | prop_html2md.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/prop_html2md.go b/prop_html2md.go index eec286c..6cba586 100644 --- a/prop_html2md.go +++ b/prop_html2md.go @@ -11,6 +11,7 @@ import ( "regexp" md "github.com/JohannesKaufmann/html-to-markdown" + "github.com/JohannesKaufmann/html-to-markdown/plugin" "github.com/PuerkitoBio/goquery" "github.com/mkideal/cli" "github.com/mkideal/cli/clis" @@ -67,6 +68,36 @@ func html2md(ctx *cli.Context) error { } clis.Verbose(2, "domain='%s'\n", domain) conv := md.NewConverter(domain, true, opt) + + // Plugin handling + if rootArgv.PluginConfluenceAttachments { + conv.Use(plugin.ConfluenceAttachments()) + } + if rootArgv.PluginConfluenceCodeBlock { + conv.Use(plugin.ConfluenceCodeBlock()) + } + // if rootArgv.PluginFrontMatter { + // conv.Use(plugin.FrontMatter()) + // } + if rootArgv.PluginGitHubFlavored { + conv.Use(plugin.GitHubFlavored()) + } + if rootArgv.PluginStrikethrough { + conv.Use(plugin.Strikethrough("")) + } + // if rootArgv.PluginTable { + // conv.Use(plugin.Table()) + // } + if rootArgv.PluginTaskListItems { + conv.Use(plugin.TaskListItems()) + } + // if rootArgv.PluginVimeoEmbed { + // conv.Use(plugin.VimeoEmbed()) + // } + // if rootArgv.PluginYoutubeEmbed { + // conv.Use(plugin.YoutubeEmbed()) + // } + markdown := conv.Convert(content) fmt.Println(markdown) |