From 59d16d09bbd2bce19c17e0688e21381b845f1159 Mon Sep 17 00:00:00 2001 From: Himura Kazuto Date: Thu, 26 Apr 2018 16:32:52 +0300 Subject: [PATCH 1/2] Images may not contain alt --- lib/rouge/lexers/markdown.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/rouge/lexers/markdown.rb b/lib/rouge/lexers/markdown.rb index 76710b5e03..06caf50777 100644 --- a/lib/rouge/lexers/markdown.rb +++ b/lib/rouge/lexers/markdown.rb @@ -75,8 +75,14 @@ def html push :url end - # links and images - rule /(!?\[)(#{edot}+?)(\])/ do + # links + rule /(\[)(#{edot}+?)(\])/ do + groups Punctuation, Name::Variable, Punctuation + push :link + end + + # images + rule /(!\[)(#{edot}*?)(\])/ do groups Punctuation, Name::Variable, Punctuation push :link end From 3e1807f61349aac930dd9974a3b8bc88648b2e4e Mon Sep 17 00:00:00 2001 From: Himura Kazuto Date: Thu, 14 Jun 2018 18:40:43 +0300 Subject: [PATCH 2/2] easy fix --- lib/rouge/lexers/markdown.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/rouge/lexers/markdown.rb b/lib/rouge/lexers/markdown.rb index 06caf50777..76d2a34a85 100644 --- a/lib/rouge/lexers/markdown.rb +++ b/lib/rouge/lexers/markdown.rb @@ -75,14 +75,8 @@ def html push :url end - # links - rule /(\[)(#{edot}+?)(\])/ do - groups Punctuation, Name::Variable, Punctuation - push :link - end - - # images - rule /(!\[)(#{edot}*?)(\])/ do + # links and images + rule /(!?\[)(#{edot}*?)(\])/ do groups Punctuation, Name::Variable, Punctuation push :link end