Make highlightCodeBlock render enclosing div tags on separate lines
This commit is contained in:
parent
53b61abfd0
commit
b1a03e2d27
6 changed files with 18 additions and 8 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"><pre>%s</pre></div>`, html.EscapeString(source))
|
||||
return fmt.Sprintf(`<div class="highlight">%s<pre>%s</pre>%s</div>`, "\n", html.EscapeString(source), "\n")
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
10
org/testdata/blocks.html
vendored
10
org/testdata/blocks.html
vendored
|
@ -1,12 +1,16 @@
|
|||
<div class="captioned">
|
||||
<div class="highlight"><pre>echo a bash source block</pre></div>
|
||||
<div class="highlight">
|
||||
<pre>echo a bash source block</pre>
|
||||
</div>
|
||||
<p class="caption">
|
||||
block!
|
||||
</p>
|
||||
</div>
|
||||
<div class="highlight"><pre>a source block without a language
|
||||
<div class="highlight">
|
||||
<pre>a source block without a language
|
||||
and a second line
|
||||
and a third one</pre></div>
|
||||
and a third one</pre>
|
||||
</div>
|
||||
<pre class="example">
|
||||
an example block
|
||||
with multiple lines
|
||||
|
|
4
org/testdata/captions.html
vendored
4
org/testdata/captions.html
vendored
|
@ -2,7 +2,9 @@
|
|||
Anything can be captioned. Also captions are not real, correct captions but just a paragraph below the element (bothe wrapped into a div)
|
||||
</p>
|
||||
<div class="captioned">
|
||||
<div class="highlight"><pre>echo "i have a caption!"</pre></div>
|
||||
<div class="highlight">
|
||||
<pre>echo "i have a caption!"</pre>
|
||||
</div>
|
||||
<p class="caption">
|
||||
captioned soure block
|
||||
</p>
|
||||
|
|
4
org/testdata/footnotes.html
vendored
4
org/testdata/footnotes.html
vendored
|
@ -40,7 +40,9 @@ and other elements
|
|||
<p>
|
||||
like blocks
|
||||
</p>
|
||||
<div class="highlight"><pre>other non-plain</pre></div>
|
||||
<div class="highlight">
|
||||
<pre>other non-plain</pre>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
|
|
4
org/testdata/lists.html
vendored
4
org/testdata/lists.html
vendored
|
@ -48,7 +48,9 @@ and some lines of text
|
|||
<p>
|
||||
and another subitem
|
||||
</p>
|
||||
<div class="highlight"><pre>echo with a block</pre></div>
|
||||
<div class="highlight">
|
||||
<pre>echo with a block</pre>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue