From 082a6fb51863893a955aa3d59bf241224c48fe0b Mon Sep 17 00:00:00 2001 From: ImportTaste <53661808+ImportTaste@users.noreply.github.com> Date: Wed, 14 Jun 2023 23:29:25 -0500 Subject:
to newline plugin --- plugin_brnewline.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 plugin_brnewline.go (limited to 'plugin_brnewline.go') 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 -- cgit v1.2.3