html: Fix inline source block highlighting & escaping
This commit is contained in:
parent
d417c2a6dd
commit
232c27327c
2 changed files with 6 additions and 1 deletions
|
@ -141,6 +141,7 @@ func (w *HTMLWriter) WriteInlineBlock(b InlineBlock) {
|
||||||
switch b.Name {
|
switch b.Name {
|
||||||
case "src":
|
case "src":
|
||||||
lang := strings.ToLower(b.Parameters[0])
|
lang := strings.ToLower(b.Parameters[0])
|
||||||
|
content = w.HighlightCodeBlock(content, lang, true)
|
||||||
w.WriteString(fmt.Sprintf("<div class=\"src src-inline src-%s\">\n%s\n</div>", lang, content))
|
w.WriteString(fmt.Sprintf("<div class=\"src src-inline src-%s\">\n%s\n</div>", lang, content))
|
||||||
case "export":
|
case "export":
|
||||||
if strings.ToLower(b.Parameters[0]) == "html" {
|
if strings.ToLower(b.Parameters[0]) == "html" {
|
||||||
|
|
6
org/testdata/inline.html
vendored
6
org/testdata/inline.html
vendored
|
@ -44,7 +44,11 @@ links with slashes do not become <em>emphasis</em>: <a href="https://somelinksho
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
inline source blocks like <div class="src src-inline src-html">
|
inline source blocks like <div class="src src-inline src-html">
|
||||||
<h1>hello</h1>
|
<div class="highlight-inline">
|
||||||
|
<pre>
|
||||||
|
<h1>hello</h1>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue