String (@NotNull PsiElement link) { String url = null; IElementType type = PsiUtilCore.getElementType(link); if (type == AUTOLINK) { url = link.getFirstChild().getNextSibling().getText(); } else if (type == MarkdownTokenTypes.GFM_AUTOLINK) { url = link.getText(); } else if (type == MarkdownTokenTypes.EMAIL_AUTOLINK) { url = link.getText(); } else if (type == INLINE_LINK) { final var syntaxTraverser = SyntaxTraverser.psiTraverser(); final var child = syntaxTraverser.children(link).find(it -> PsiUtilCore.getElementType(it) == LINK_DESTINATION); if (child != null) { url = child.getText(); } } return url; }