aboutsummaryrefslogtreecommitdiff
path: root/plugin_brnewline.go
diff options
context:
space:
mode:
authorsuntong <[email protected]>2023-06-15 17:31:56 -0400
committerGitHub <[email protected]>2023-06-15 17:31:56 -0400
commitc8a4f8f1f04e2a6e4f5f916e9a40657c65364d19 (patch)
treee18c23ac44ea5a9ac5e71b446e30aa5ea5d437b9 /plugin_brnewline.go
parentUpdate bug-report-template.md (diff)
parent<br> to newline plugin (diff)
downloadhtml2md-c8a4f8f1f04e2a6e4f5f916e9a40657c65364d19.tar.xz
html2md-c8a4f8f1f04e2a6e4f5f916e9a40657c65364d19.zip
Merge pull request #16 from ImportTaste/master
<br> to newline plugin
Diffstat (limited to 'plugin_brnewline.go')
-rw-r--r--plugin_brnewline.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugin_brnewline.go b/plugin_brnewline.go
new file mode 100644
index 0000000..0e5c6b0
--- /dev/null
+++ b/plugin_brnewline.go
@@ -0,0 +1,20 @@
+package main
+
+import (
+ md "github.com/JohannesKaufmann/html-to-markdown"
+ "github.com/PuerkitoBio/goquery"
+)
+
+// TaskListItems converts checkboxes into task list items.
+func BrToNewline() md.Plugin {
+ return func(c *md.Converter) []md.Rule {
+ return []md.Rule{
+ {
+ Filter: []string{"br"},
+ Replacement: func(content string, selec *goquery.Selection, opt *md.Options) *string {
+ return md.String("\n")
+ },
+ },
+ }
+ }
+} \ No newline at end of file