Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion imgui_markdown.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ namespace ImGui
TextBlock text;
TextBlock url;
bool isImage = false;
int num_square_brackets_open = 0;
int num_brackets_open = 0;
};

Expand Down Expand Up @@ -602,14 +603,23 @@ namespace ImGui
{
link.state = Link::HAS_SQUARE_BRACKET_OPEN;
link.text.start = i + 1;
link.num_square_brackets_open = 1;
if( i > 0 && markdown_[i - 1] == '!' )
{
link.isImage = true;
}
}
break;
case Link::HAS_SQUARE_BRACKET_OPEN:
if( c == ']' )
if( c == '[' )
{
++link.num_square_brackets_open;
}
else if( c == ']' )
{
--link.num_square_brackets_open;
}
if( link.num_square_brackets_open == 0 )
{
link.state = Link::HAS_SQUARE_BRACKETS;
link.text.stop = i;
Expand Down