Skip to content

Commit c55f9da

Browse files
committed
fix(autolink): fix rendering of nested markdown link with
- with autolink + useMarkdown props [href2](href1) syntax is rendered as <a href1><a href2>href2</a></a> instead of href2 being a plain text Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent 840f2d5 commit c55f9da

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/components/NcRichText/autolink.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export function remarkAutolink({ autolink, useMarkdown, useExtendedMarkdown }) {
4646
}
4747

4848
visit(tree, (node) => node.type === 'text', (node, index, parent) => {
49+
// Do not autolink text already inside a link node
50+
if (parent?.type === 'link' || parent?.type === 'linkReference') {
51+
return
52+
}
53+
4954
let parsed = parseUrl(node.value)
5055
if (typeof parsed === 'string') {
5156
parsed = [u('text', parsed)]

0 commit comments

Comments
 (0)