diff --git a/config.yaml.example b/config.yaml.example index 5558094..5516fee 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -98,12 +98,6 @@ filter: - Do not change the capitalization of WikiNames. - Do not translate or rephrase WikiNames. - Treat WikiNames as indivisible symbols, similar to `[[links]]`. - creole: | - ## Markup rules - - Interpret the content as Wiki Creole. - markdown: | - ## Markup rules - - Interpret the content as Markdown. nomark: | ## Markup rules - Interpret the content as Nomark, a custom minimal format that is mostly plain text. @@ -117,6 +111,12 @@ filter: In Nomark syntax, headings are written like !!! Title !!! with three or more ! on each side. The exact count of ! characters must be preserved. + creole: | + ## Markup rules + - Interpret the content as WikiCreole. + markdown: | + ## Markup rules + - Interpret the content as Markdown. image-filter: agent: "ChatGPT" diff --git a/internal/config/config.go b/internal/config/config.go index 895d10f..cf43458 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -51,9 +51,9 @@ type Config struct { Prompt string `yaml:"prompt"` Temperature float64 `yaml:"temperature"` Common string `yaml:"common"` + Nomark string `yaml:"nomark"` Creole string `yaml:"creole"` Markdown string `yaml:"markdown"` - Nomark string `yaml:"nomark"` } `yaml:"filter"` ImageFilter struct { diff --git a/internal/config/public.go b/internal/config/public.go index d4abdcf..3e8c5e9 100644 --- a/internal/config/public.go +++ b/internal/config/public.go @@ -23,9 +23,9 @@ type Public struct { Prompt string Temperature float64 Common string + Nomark string Creole string Markdown string - Nomark string } ImageFilter struct { @@ -79,18 +79,18 @@ func Publish(cfg *Config) Public { Prompt string Temperature float64 Common string + Nomark string Creole string Markdown string - Nomark string }{ Agent: cfg.Filter.Agent, System: cfg.Filter.System, Prompt: cfg.Filter.Prompt, Temperature: cfg.Filter.Temperature, Common: cfg.Filter.Common, + Nomark: cfg.Filter.Nomark, Creole: cfg.Filter.Creole, Markdown: cfg.Filter.Markdown, - Nomark: cfg.Filter.Nomark, }, ImageFilter: struct { diff --git a/internal/format/apply.go b/internal/format/apply.go index 8861b88..02cec04 100644 --- a/internal/format/apply.go +++ b/internal/format/apply.go @@ -11,23 +11,23 @@ import ( func Detect(cfg *config.Config, text string) string { if len(text) > 0 { // detect markup by very first character of input text. + // * '!' : Nomark // * '=' : Creole // * '#' : Markdown - // * '!' : Nomark head := text[0] - if head == '=' { + if head == '!' { + return "nomark" + } else if head == '=' { return "creole" } else if head == '#' { return "markdown" - } else if head == '!' { - return "nomark" } } // no headers // Chosen by config conf := cfg.Wiki.Format - if conf == "creole" || conf == "markdown" || conf == "nomark" { + if conf == "nomark" || conf == "creole" || conf == "markdown" { return conf } @@ -46,7 +46,7 @@ func Apply(cfg *config.Config, title string, text string) (string, string, strin } else if mode == "markdown" { fc := markdown.ToFormatConfig(cfg) return markdown.Apply(fc, title, text) - } else { + } else { // nomark fc := nomark.ToFormatConfig(cfg) return nomark.Apply(fc, title, text) } diff --git a/internal/util/templates/info.html b/internal/util/templates/info.html index 029716d..bcd40a8 100644 --- a/internal/util/templates/info.html +++ b/internal/util/templates/info.html @@ -109,6 +109,10 @@ Common =
{{.Public.Filter.Common}}
+Nomark = +
{{.Public.Filter.Nomark}}
+
+Creole =
{{.Public.Filter.Creole}}
@@ -116,10 +120,6 @@ Creole =
Markdown =
{{.Public.Filter.Markdown}}
--Nomark = -
{{.Public.Filter.Nomark}}
-