File: callouts_test.go

package info (click to toggle)
golang-github-gomarkdown-markdown 0.0~git20220731.dcdaee8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 940 kB
  • sloc: sh: 23; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (2)
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
package html

import (
	"bytes"
	"testing"
)

func TestEscapeHTMLCallouts(t *testing.T) {
	buf := &bytes.Buffer{}
	code := []byte(`println("hello")
more code //<<4>>
bliep bliep
`)
	out := `println(&quot;hello&quot;)
more code <span class="callout">4</span>
bliep bliep
`
	opts := RendererOptions{}
	opts.Comments = [][]byte{[]byte("//")}

	r := NewRenderer(opts)
	r.EscapeHTMLCallouts(buf, code)

	if buf.String() != out {
		t.Error("callout code block not correctly parsed")
	}
}