Fix default HighlightCodeBlock fn: Write tags on separate lines
This commit is contained in:
parent
486720c1b1
commit
a859264420
5 changed files with 17 additions and 7 deletions
|
@ -34,7 +34,7 @@ var listTags = map[string][]string{
|
|||
func NewHTMLWriter() *HTMLWriter {
|
||||
return &HTMLWriter{
|
||||
HighlightCodeBlock: func(source, lang string) string {
|
||||
return fmt.Sprintf(`<div class="highlight">%s<pre>%s</pre>%s</div>`, "\n", html.EscapeString(source), "\n")
|
||||
return fmt.Sprintf("%s\n<pre>\n%s\n</pre>\n</div>", `<div class="highlight">`, html.EscapeString(source))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
10
org/testdata/blocks.html
vendored
10
org/testdata/blocks.html
vendored
|
@ -1,19 +1,23 @@
|
|||
<div class="captioned">
|
||||
<div class="highlight">
|
||||
<pre>echo "a bash source block"
|
||||
<pre>
|
||||
echo "a bash source block"
|
||||
|
||||
function hello {
|
||||
echo Hello World!
|
||||
}
|
||||
|
||||
hello</pre>
|
||||
hello
|
||||
</pre>
|
||||
</div>
|
||||
<p class="caption">
|
||||
block caption
|
||||
</p>
|
||||
</div>
|
||||
<div class="highlight">
|
||||
<pre>a source block without a language</pre>
|
||||
<pre>
|
||||
a source block without a language
|
||||
</pre>
|
||||
</div>
|
||||
<pre class="example">
|
||||
an example block with
|
||||
|
|
4
org/testdata/captions.html
vendored
4
org/testdata/captions.html
vendored
|
@ -3,7 +3,9 @@ Anything can be captioned. Also captions are not real, correct captions but just
|
|||
</p>
|
||||
<div class="captioned">
|
||||
<div class="highlight">
|
||||
<pre>echo "i have a caption!"</pre>
|
||||
<pre>
|
||||
echo "i have a caption!"
|
||||
</pre>
|
||||
</div>
|
||||
<p class="caption">
|
||||
captioned soure block
|
||||
|
|
4
org/testdata/footnotes.html
vendored
4
org/testdata/footnotes.html
vendored
|
@ -41,7 +41,9 @@ and other elements
|
|||
like blocks
|
||||
</p>
|
||||
<div class="highlight">
|
||||
<pre>other non-plain</pre>
|
||||
<pre>
|
||||
other non-plain
|
||||
</pre>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
4
org/testdata/lists.html
vendored
4
org/testdata/lists.html
vendored
|
@ -49,7 +49,9 @@ and some lines of text
|
|||
and another subitem
|
||||
</p>
|
||||
<div class="highlight">
|
||||
<pre>echo with a block</pre>
|
||||
<pre>
|
||||
echo with a block
|
||||
</pre>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue