new -t option to toggle prettyTables (preformatted layout)
better rendering of tables in normal mode remove borders on prettyTables
This commit is contained in:
parent
ecff86bd27
commit
fa5f0aac1b
12
README.md
12
README.md
@ -16,6 +16,7 @@ html2gmi <flags>
|
||||
-n, --numberedLinks Number the links
|
||||
-o, --output string Output path. Otherwise uses stdout
|
||||
-e, --emitImagesAsLinks Emit links to included images
|
||||
-t, --prettyTables Pretty tables - works with most simple tables
|
||||
-v, --version Find out what version of html2gmi you're running
|
||||
|
||||
|
||||
@ -29,8 +30,7 @@ html2gmi <flags>
|
||||
* citationMarkers - use a numbered marker in the text to indicate the location of the citation, [1], [2] etc.
|
||||
* numberedLinks - number the links with a reference number [1], [2] etc. Certain command line Gemini clients may automatically add these, in which case you can omit them.
|
||||
* emitImagesAsLinks - add a link for every embedded image in addition to its placemarker
|
||||
|
||||
Simple tables will be displayed as preformatted content. Complex tables may not look perfect.
|
||||
* prettyTables - tables will be displayed as preformatted content. Complex tables may not look perfect. Otherwise each table row is a new line.
|
||||
|
||||
You can pipe content in from other applications, for example utilities that download HTML from the web.
|
||||
|
||||
@ -55,7 +55,13 @@ go build github.com/LukeEmmet/html2gmi
|
||||
|
||||
# History
|
||||
|
||||
## 0.2.3
|
||||
## 0.2.5
|
||||
|
||||
* new -t flag to emit pretty tables (as preformatted content)
|
||||
* improve table rendering when prettyTables is off
|
||||
* don't use a border marker for preformatted tables
|
||||
|
||||
## 0.2.4
|
||||
|
||||
* option to toggle emitting links for embedded images
|
||||
|
||||
|
25
html2gmi.go
25
html2gmi.go
@ -11,7 +11,7 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var version = "0.2.3"
|
||||
var version = "0.2.5"
|
||||
|
||||
var (
|
||||
output = flag.StringP("output", "o", "", "Output path. Otherwise uses stdout")
|
||||
@ -19,6 +19,8 @@ var (
|
||||
citationStart = flag.IntP("citationStart", "c", 1, "Start citations from this index")
|
||||
citationMarkers = flag.BoolP("citationMarkers", "m", false, "Use footnote style citation markers")
|
||||
numberedLinks = flag.BoolP("numberedLinks", "n", false, "Number the links")
|
||||
prettyTables = flag.BoolP("prettyTables", "t", false, "Pretty tables - works with most simple tables")
|
||||
emitImagesAsLinks = flag.BoolP("emitImagesAsLinks", "e", false, "Emit links to included images")
|
||||
linkEmitFrequency = flag.IntP("linkEmitFrequency", "l", 2, "Emit gathered links through the document after this number of paragraphs")
|
||||
verFlag = flag.BoolP("version", "v", false, "Find out what version of html2gmi you're running")
|
||||
)
|
||||
@ -90,22 +92,33 @@ func main() {
|
||||
|
||||
//convert html to gmi
|
||||
options := html2gemini.NewOptions()
|
||||
options.PrettyTables = true
|
||||
options.PrettyTables = *prettyTables
|
||||
options.CitationStart = *citationStart
|
||||
options.LinkEmitFrequency = *linkEmitFrequency
|
||||
options.CitationMarkers = *citationMarkers
|
||||
options.NumberedLinks = *numberedLinks
|
||||
options.EmitImagesAsLinks = *emitImagesAsLinks
|
||||
|
||||
//use slightly nicer Unicode borders, otherwise can use +,|,-
|
||||
options.PrettyTablesOptions.CenterSeparator = "┼"
|
||||
options.PrettyTablesOptions.ColumnSeparator = "│"
|
||||
options.PrettyTablesOptions.RowSeparator = "─"
|
||||
|
||||
//dont use an extra line to separate header from body, but
|
||||
//do separate each row visually
|
||||
options.PrettyTablesOptions.HeaderLine = false
|
||||
options.PrettyTablesOptions.RowLine = true
|
||||
|
||||
//use slightly nicer Unicode borders, otherwise can use +,|,-
|
||||
//options.PrettyTablesOptions.CenterSeparator = "┼"
|
||||
//options.PrettyTablesOptions.ColumnSeparator = "│"
|
||||
//options.PrettyTablesOptions.RowSeparator = "─"
|
||||
|
||||
//pretty tables option is somewhat experimental
|
||||
//and the column positions not always correct
|
||||
//so use invisible borders of spaces for now
|
||||
options.PrettyTablesOptions.CenterSeparator = " "
|
||||
options.PrettyTablesOptions.ColumnSeparator = " "
|
||||
options.PrettyTablesOptions.RowSeparator = " "
|
||||
|
||||
|
||||
|
||||
text, err := html2gemini.FromString(inputHtml, *options)
|
||||
|
||||
check(err)
|
||||
|
Loading…
Reference in New Issue
Block a user