@@ -436,6 +436,7 @@ namespace ImGui
436436 HAS_SQUARE_BRACKET_OPEN,
437437 HAS_SQUARE_BRACKETS,
438438 HAS_SQUARE_BRACKETS_ROUND_BRACKET_OPEN,
439+ HAS_ANGLE_BRACKET_OPEN,
439440 };
440441 LinkState state = NO_LINK;
441442 TextBlock text;
@@ -525,7 +526,6 @@ namespace ImGui
525526 inline void Markdown ( const char * markdown_, size_t markdownLength_, const MarkdownConfig& mdConfig_ )
526527 {
527528 static const char * linkHoverStart = NULL ; // we need to preserve status of link hovering between frames
528- ImGuiStyle& style = ImGui::GetStyle ();
529529 Line line;
530530 Link link;
531531 Emphasis em;
@@ -598,13 +598,23 @@ namespace ImGui
598598 switch ( link.state )
599599 {
600600 case Link::NO_LINK:
601- if ( c == ' [ ' && !line.isHeading ) // we do not support headings with links for now
601+ if ( !line.isHeading )
602602 {
603- link.state = Link::HAS_SQUARE_BRACKET_OPEN;
604- link.text .start = i + 1 ;
605- if ( i > 0 && markdown_[i - 1 ] == ' !' )
603+ if ( c == ' [' ) // we do not support headings with links for now
606604 {
607- link.isImage = true ;
605+ link.state = Link::HAS_SQUARE_BRACKET_OPEN;
606+ link.text .start = i + 1 ;
607+ if ( i > 0 && markdown_[i - 1 ] == ' !' )
608+ {
609+ link.isImage = true ;
610+ }
611+ }
612+ else if ( c == ' <' )
613+ {
614+ link.state = Link::HAS_ANGLE_BRACKET_OPEN;
615+ link.text .start = i + 1 ;
616+ link.url .start = i + 1 ;
617+ // I don't think autolinks have image support
608618 }
609619 }
610620 break ;
@@ -681,8 +691,30 @@ namespace ImGui
681691 // reset the link by reinitializing it
682692 link = Link ();
683693 line.lastRenderPosition = i;
684- break ;
694+
685695 }
696+ break ;
697+
698+ case Link::HAS_ANGLE_BRACKET_OPEN:
699+ if ( c == ' >' )
700+ {
701+ // reset emphasis status, we do not support emphasis around links for now
702+ em = Emphasis ();
703+ // render previous line content
704+ line.lineEnd = link.text .start - 1 ;
705+ RenderLine ( markdown_, line, textRegion, mdConfig_ );
706+ line.leadSpaceCount = 0 ;
707+ link.text .stop = i;
708+ link.url .stop = i;
709+ line.isUnorderedListStart = false ; // the following text shouldn't have bullets
710+ ImGui::SameLine ( 0 .0f , 0 .0f );
711+ textRegion.RenderLinkTextWrapped ( markdown_ + link.text .start , markdown_ + link.text .start + link.text .size (), link, markdown_, mdConfig_, &linkHoverStart, false );
712+ ImGui::SameLine ( 0 .0f , 0 .0f );
713+ // reset the link by reinitializing it
714+ link = Link ();
715+ line.lastRenderPosition = i;
716+ }
717+ break ;
686718 }
687719
688720 // Test to see if we have emphasis styling
0 commit comments