diff --git a/blorg/util.go b/blorg/util.go index 05d74e2..e24ea9a 100644 --- a/blorg/util.go +++ b/blorg/util.go @@ -55,7 +55,7 @@ func getWriter() org.Writer { return w } -func highlightCodeBlock(source, lang string, inline bool) string { +func highlightCodeBlock(source, lang string, inline bool, params map[string]string) string { var w strings.Builder l := lexers.Get(lang) if l == nil { diff --git a/main.go b/main.go index 0b0a21a..c400d56 100644 --- a/main.go +++ b/main.go @@ -119,7 +119,7 @@ func render(args []string) { } } -func highlightCodeBlock(source, lang string, inline bool) string { +func highlightCodeBlock(source, lang string, inline bool, params map[string]string) string { var w strings.Builder l := lexers.Get(lang) if l == nil { diff --git a/org/html_writer.go b/org/html_writer.go index fc0780a..5f388d9 100644 --- a/org/html_writer.go +++ b/org/html_writer.go @@ -19,7 +19,7 @@ import ( // HTMLWriter exports an org document into a html document. type HTMLWriter struct { ExtendingWriter Writer - HighlightCodeBlock func(source, lang string, inline bool) string + HighlightCodeBlock func(source, lang string, inline bool, params map[string]string) string PrettyRelativeLinks bool strings.Builder @@ -66,7 +66,7 @@ func NewHTMLWriter() *HTMLWriter { document: &Document{Configuration: defaultConfig}, log: defaultConfig.Log, htmlEscape: true, - HighlightCodeBlock: func(source, lang string, inline bool) string { + HighlightCodeBlock: func(source, lang string, inline bool, params map[string]string) string { if inline { return fmt.Sprintf("
\n
\n%s\n
\n
", html.EscapeString(source)) } @@ -129,7 +129,7 @@ func (w *HTMLWriter) WriteBlock(b Block) { if len(b.Parameters) >= 1 { lang = strings.ToLower(b.Parameters[0]) } - content = w.HighlightCodeBlock(content, lang, false) + content = w.HighlightCodeBlock(content, lang, false, params) w.WriteString(fmt.Sprintf("
\n%s\n
\n", lang, content)) case "EXAMPLE": w.WriteString(`
` + "\n" + html.EscapeString(content) + "\n
\n") @@ -159,7 +159,7 @@ func (w *HTMLWriter) WriteInlineBlock(b InlineBlock) { switch b.Name { case "src": lang := strings.ToLower(b.Parameters[0]) - content = w.HighlightCodeBlock(content, lang, true) + content = w.HighlightCodeBlock(content, lang, true, nil) w.WriteString(fmt.Sprintf("
\n%s\n
", lang, content)) case "export": if strings.ToLower(b.Parameters[0]) == "html" {