forked from suntong/html2md
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml2md_main.go
More file actions
73 lines (62 loc) · 1.99 KB
/
html2md_main.go
File metadata and controls
73 lines (62 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
////////////////////////////////////////////////////////////////////////////
// Program: html2md
// Purpose: HTML to Markdown
// Authors: Tong Sun (c) 2020, All rights reserved
////////////////////////////////////////////////////////////////////////////
package main
//go:generate sh -v html2md_cliGen.sh
import (
"fmt"
"os"
"github.com/mkideal/cli"
clix "github.com/mkideal/cli/ext"
)
////////////////////////////////////////////////////////////////////////////
// Constant and data type/structure definitions
// The OptsT type defines all the configurable options from cli.
type OptsT struct {
Filei *clix.Reader
Sel string
OptHeadingStyle string
OptHorizontalRule string
OptBulletListMarker string
OptCodeBlockStyle string
OptFence string
OptEmDelimiter string
OptStrongDelimiter string
OptLinkStyle string
OptLinkReferenceStyle string
PluginConfluenceAttachments bool
PluginConfluenceCodeBlock bool
PluginFrontMatter bool
PluginGitHubFlavored bool
PluginStrikethrough bool
PluginTable bool
PluginTaskListItems bool
PluginVimeoEmbed bool
PluginYoutubeEmbed bool
Verbose int
}
////////////////////////////////////////////////////////////////////////////
// Global variables definitions
var (
progname = "html2md"
version = "0.2.01"
date = "2020-08-08"
rootArgv *rootT
// Opts store all the configurable options
Opts OptsT
)
////////////////////////////////////////////////////////////////////////////
// Function definitions
// Function main
func main() {
cli.SetUsageStyle(cli.DenseNormalStyle) // left-right, for up-down, use ManualStyle
//NOTE: You can set any writer implements io.Writer
// default writer is os.Stdout
if err := cli.Root(root).Run(os.Args[1:]); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Println("")
}