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 {
|
func NewHTMLWriter() *HTMLWriter {
|
||||||
return &HTMLWriter{
|
return &HTMLWriter{
|
||||||
HighlightCodeBlock: func(source, lang string) string {
|
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="captioned">
|
||||||
<div class="highlight">
|
<div class="highlight">
|
||||||
<pre>echo "a bash source block"
|
<pre>
|
||||||
|
echo "a bash source block"
|
||||||
|
|
||||||
function hello {
|
function hello {
|
||||||
echo Hello World!
|
echo Hello World!
|
||||||
}
|
}
|
||||||
|
|
||||||
hello</pre>
|
hello
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<p class="caption">
|
<p class="caption">
|
||||||
block caption
|
block caption
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="highlight">
|
<div class="highlight">
|
||||||
<pre>a source block without a language</pre>
|
<pre>
|
||||||
|
a source block without a language
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<pre class="example">
|
<pre class="example">
|
||||||
an example block with
|
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>
|
</p>
|
||||||
<div class="captioned">
|
<div class="captioned">
|
||||||
<div class="highlight">
|
<div class="highlight">
|
||||||
<pre>echo "i have a caption!"</pre>
|
<pre>
|
||||||
|
echo "i have a caption!"
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<p class="caption">
|
<p class="caption">
|
||||||
captioned soure block
|
captioned soure block
|
||||||
|
|
4
org/testdata/footnotes.html
vendored
4
org/testdata/footnotes.html
vendored
|
@ -41,7 +41,9 @@ and other elements
|
||||||
like blocks
|
like blocks
|
||||||
</p>
|
</p>
|
||||||
<div class="highlight">
|
<div class="highlight">
|
||||||
<pre>other non-plain</pre>
|
<pre>
|
||||||
|
other non-plain
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<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
|
and another subitem
|
||||||
</p>
|
</p>
|
||||||
<div class="highlight">
|
<div class="highlight">
|
||||||
<pre>echo with a block</pre>
|
<pre>
|
||||||
|
echo with a block
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue