mirror of
https://github.com/kovetskiy/mark.git
synced 2025-12-13 04:07:36 +08:00
Strip double quotes from admonition titles
This commit is contained in:
parent
5fd79b897e
commit
0583aaa7ce
@ -2,6 +2,7 @@ package renderer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
parser "github.com/stefanfritsch/goldmark-admonitions"
|
||||
"github.com/yuin/goldmark/ast"
|
||||
@ -114,8 +115,11 @@ func (r *ConfluenceMkDocsAdmonitionRenderer) renderMkDocsAdmonition(writer util.
|
||||
if _, err := writer.Write([]byte(prefix)); err != nil {
|
||||
return ast.WalkStop, err
|
||||
}
|
||||
if string(n.Title) != "" {
|
||||
titleHTML := fmt.Sprintf("<p><strong>%s</strong></p>\n", string(n.Title))
|
||||
|
||||
title := strings.Trim(string(n.Title), "\"")
|
||||
|
||||
if title != "" {
|
||||
titleHTML := fmt.Sprintf("<p><strong>%s</strong></p>\n", title)
|
||||
if _, err := writer.Write([]byte(titleHTML)); err != nil {
|
||||
return ast.WalkStop, err
|
||||
}
|
||||
|
||||
10
testdata/admonitions.html
vendored
10
testdata/admonitions.html
vendored
@ -1,7 +1,7 @@
|
||||
<h1 id="Main-Heading">Main Heading</h1>
|
||||
<h2 id="First-Heading">First Heading</h2>
|
||||
<ac:structured-macro ac:name="note"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
|
||||
<p><strong>"NOTES:"</strong></p>
|
||||
<p><strong>NOTES:</strong></p>
|
||||
<ol>
|
||||
<li>Note number one</li>
|
||||
<li>Note number two</li>
|
||||
@ -14,7 +14,7 @@ b</p>
|
||||
</ac:rich-text-body></ac:structured-macro>
|
||||
<h2 id="Second-Heading">Second Heading</h2>
|
||||
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
|
||||
<p><strong>"Warn"</strong></p>
|
||||
<p><strong>Warn</strong></p>
|
||||
<ul>
|
||||
<li>Warn bullet 1</li>
|
||||
<li>Warn bullet 2</li>
|
||||
@ -30,7 +30,7 @@ that runs long</li>
|
||||
</ac:rich-text-body></ac:structured-macro>
|
||||
<h2 id="Fourth-Heading---Warn-should-not-get-picked-as-block-quote">Fourth Heading - Warn should not get picked as block quote</h2>
|
||||
<ac:structured-macro ac:name="tip"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
|
||||
<p><strong>"TIP:"</strong></p>
|
||||
<p><strong>TIP:</strong></p>
|
||||
<ol>
|
||||
<li>Note number one</li>
|
||||
<li>Note number two</li>
|
||||
@ -69,14 +69,14 @@ b</p>
|
||||
</ac:rich-text-body></ac:structured-macro>
|
||||
<h3 id="Important/Caution-Type-Alert-Heading">Important/Caution Type Alert Heading</h3>
|
||||
<ac:structured-macro ac:name="info"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
|
||||
<p><strong>"[!IMPORTANT]"</strong></p>
|
||||
<p><strong>[!IMPORTANT]</strong></p>
|
||||
<ul>
|
||||
<li>Important bullet 1</li>
|
||||
<li>Important bullet 2</li>
|
||||
</ul>
|
||||
</ac:rich-text-body></ac:structured-macro>
|
||||
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
|
||||
<p><strong>"[!CAUTION]"</strong></p>
|
||||
<p><strong>[!CAUTION]</strong></p>
|
||||
<ul>
|
||||
<li>Important bullet 1</li>
|
||||
<li>Important bullet 2</li>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user