Skip to content

Commit 9b56fc9

Browse files
committed
highlight: Expose node params so we can pass options to Chroma
1 parent 3c938e7 commit 9b56fc9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

blorg/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func getWriter() org.Writer {
5555
return w
5656
}
5757

58-
func highlightCodeBlock(source, lang string, inline bool) string {
58+
func highlightCodeBlock(source, lang string, inline bool, params map[string]string) string {
5959
var w strings.Builder
6060
l := lexers.Get(lang)
6161
if l == nil {

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func render(args []string) {
119119
}
120120
}
121121

122-
func highlightCodeBlock(source, lang string, inline bool) string {
122+
func highlightCodeBlock(source, lang string, inline bool, params map[string]string) string {
123123
var w strings.Builder
124124
l := lexers.Get(lang)
125125
if l == nil {

org/html_writer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
// HTMLWriter exports an org document into a html document.
2020
type HTMLWriter struct {
2121
ExtendingWriter Writer
22-
HighlightCodeBlock func(source, lang string, inline bool) string
22+
HighlightCodeBlock func(source, lang string, inline bool, params map[string]string) string
2323
PrettyRelativeLinks bool
2424

2525
strings.Builder
@@ -66,7 +66,7 @@ func NewHTMLWriter() *HTMLWriter {
6666
document: &Document{Configuration: defaultConfig},
6767
log: defaultConfig.Log,
6868
htmlEscape: true,
69-
HighlightCodeBlock: func(source, lang string, inline bool) string {
69+
HighlightCodeBlock: func(source, lang string, inline bool, params map[string]string) string {
7070
if inline {
7171
return fmt.Sprintf("<div class=\"highlight-inline\">\n<pre>\n%s\n</pre>\n</div>", html.EscapeString(source))
7272
}
@@ -129,7 +129,7 @@ func (w *HTMLWriter) WriteBlock(b Block) {
129129
if len(b.Parameters) >= 1 {
130130
lang = strings.ToLower(b.Parameters[0])
131131
}
132-
content = w.HighlightCodeBlock(content, lang, false)
132+
content = w.HighlightCodeBlock(content, lang, false, params)
133133
w.WriteString(fmt.Sprintf("<div class=\"src src-%s\">\n%s\n</div>\n", lang, content))
134134
case "EXAMPLE":
135135
w.WriteString(`<pre class="example">` + "\n" + html.EscapeString(content) + "\n</pre>\n")
@@ -159,7 +159,7 @@ func (w *HTMLWriter) WriteInlineBlock(b InlineBlock) {
159159
switch b.Name {
160160
case "src":
161161
lang := strings.ToLower(b.Parameters[0])
162-
content = w.HighlightCodeBlock(content, lang, true)
162+
content = w.HighlightCodeBlock(content, lang, true, nil)
163163
w.WriteString(fmt.Sprintf("<div class=\"src src-inline src-%s\">\n%s\n</div>", lang, content))
164164
case "export":
165165
if strings.ToLower(b.Parameters[0]) == "html" {

0 commit comments

Comments
 (0)