Merge pull request #248 from prokod/bugfix/prokod/#247

To add fallback to blockquote when type is none
This commit is contained in:
Manuel Rüger 2023-01-31 14:18:48 +01:00 committed by GitHub
commit b82e18f8b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 3 deletions

View File

@ -207,6 +207,15 @@ use `-` as the first character, if you want to have the other goodies
[Code Block Macro]: https://confluence.atlassian.com/doc/code-block-macro-139390.html
### Block Quotes
Block Quotes are converted to Confluence Info/Warn/Note box when the following conditions are met
1. The BlockQuote is on the root level of the document (not nested)
1. The first line of the BlockQuote contains one of the following patterns `Info/Warn/Note`
In any other case the default behaviour will be resumed and html `<blockquote>` tag will be used
## Template & Macros
By default, mark provides several built-in templates and macros:

View File

@ -247,7 +247,7 @@ func (renderer ConfluenceRenderer) RenderNode(
re := regexp.MustCompile(`[\n\t]`)
if quoteLevel == 0 && entering {
if quoteLevel == 0 && entering && quoteType != None {
if _, err := writer.Write([]byte(re.ReplaceAllString(fmt.Sprintf(`
<ac:structured-macro ac:name="%s">
<ac:parameter ac:name="icon">true</ac:parameter>
@ -257,7 +257,7 @@ func (renderer ConfluenceRenderer) RenderNode(
}
return bf.GoToNext
}
if quoteLevel == 0 && !entering {
if quoteLevel == 0 && !entering && quoteType != None {
if _, err := writer.Write([]byte(re.ReplaceAllString(`
</ac:rich-text-body>
</ac:structured-macro>

View File

@ -24,4 +24,9 @@ b</p>
<li>Warn bullet 1</li>
<li>Warn bullet 2</li>
</ul>
</ac:rich-text-body></ac:structured-macro>
</ac:rich-text-body></ac:structured-macro>
<h2 id="simple-blockquote">Simple Blockquote</h2>
<blockquote>
<p>This paragraph is a simple blockquote</p>
</blockquote>

View File

@ -18,3 +18,7 @@
>
> * Warn bullet 1
> * Warn bullet 2
## Simple Blockquote
> This paragraph is a simple blockquote