mirror of
https://github.com/kovetskiy/mark.git
synced 2026-05-02 05:12:35 +00:00
Fix custom link renderer and add tests for Confluence links
Since we now have a custom parser for <ac:*/> tags, the custom link renderer added an additional </a> tag at the end of each internal Confluence link. Add tests for internal links and add an example for internal links with spaces in page titles to the README file.
This commit is contained in:
@@ -276,9 +276,8 @@ func (r *ConfluenceRenderer) renderLink(writer util.BufWriter, source []byte, no
|
||||
if err != nil {
|
||||
return ast.WalkStop, err
|
||||
}
|
||||
|
||||
return ast.WalkSkipChildren, nil
|
||||
}
|
||||
return ast.WalkSkipChildren, nil
|
||||
}
|
||||
return r.goldmarkRenderLink(writer, source, node, entering)
|
||||
}
|
||||
|
||||
4
pkg/mark/testdata/links.html
vendored
4
pkg/mark/testdata/links.html
vendored
@@ -1,5 +1,9 @@
|
||||
<p>Use <a href="https://example.com">https://example.com</a></p>
|
||||
<p>Use <ac:rich-text-body>aaa</ac:rich-text-body></p>
|
||||
<p>Use <ac:link><ri:page ri:content-title="Page"/><ac:plain-text-link-body><![CDATA[page link]]></ac:plain-text-link-body></ac:link></p>
|
||||
<p>Use <ac:link><ri:page ri:content-title="AnotherPage"/><ac:plain-text-link-body><![CDATA[AnotherPage]]></ac:plain-text-link-body></ac:link></p>
|
||||
<p>Use <ac:link><ri:page ri:content-title="Another Page"/><ac:plain-text-link-body><![CDATA[Another Page]]></ac:plain-text-link-body></ac:link></p>
|
||||
<p>Use <ac:link><ri:page ri:content-title="Page With Space"/><ac:plain-text-link-body><![CDATA[page link with spaces]]></ac:plain-text-link-body></ac:link></p>
|
||||
<p>Use footnotes link <sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></p>
|
||||
<div class="footnotes" role="doc-endnotes">
|
||||
<hr />
|
||||
|
||||
8
pkg/mark/testdata/links.md
vendored
8
pkg/mark/testdata/links.md
vendored
@@ -2,5 +2,13 @@ Use <https://example.com>
|
||||
|
||||
Use <ac:rich-text-body>aaa</ac:rich-text-body>
|
||||
|
||||
Use [page link](ac:Page)
|
||||
|
||||
Use [AnotherPage](ac:)
|
||||
|
||||
Use [Another Page](ac:)
|
||||
|
||||
Use [page link with spaces](<ac:Page With Space>)
|
||||
|
||||
Use footnotes link [^1]
|
||||
[^1]: a footnote link
|
||||
Reference in New Issue
Block a user