diff --git a/lexers/m/markdown.go b/lexers/m/markdown.go index 9ee157b..e50e470 100644 --- a/lexers/m/markdown.go +++ b/lexers/m/markdown.go @@ -40,7 +40,7 @@ func markdownRules() Rules { }, "inline": { {`\\.`, Text, nil}, - {`(\s)([*_][^*_]+[*_])(\W|\n)`, ByGroups(Text, GenericEmph, Text), nil}, + {`(\s)(\*|_)((?:(?!\2).)*)(\2)((?=\W|\n))`, ByGroups(Text, GenericEmph, GenericEmph, GenericEmph, Text), nil}, {`(\s)((\*\*|__).*?)\3((?=\W|\n))`, ByGroups(Text, GenericStrong, GenericStrong, Text), nil}, {`(\s)(~~[^~]+~~)((?=\W|\n))`, ByGroups(Text, GenericDeleted, Text), nil}, {"`[^`]+`", LiteralStringBacktick, nil}, diff --git a/lexers/testdata/markdown.actual b/lexers/testdata/markdown.actual index 146ae3c..3673c15 100644 --- a/lexers/testdata/markdown.actual +++ b/lexers/testdata/markdown.actual @@ -4,18 +4,20 @@ Multiple **bold** on the **same line**. +Multiple _italic_ on the *same_line*. + ## user defined function in cql ```javascript - column.substring(0,num) + column.substring(0,num) ``` ```cql CREATE FUNCTION IF NOT EXISTS cycling.left (column TEXT,num int) RETURNS NULL ON NULL INPUT RETURNS text -LANGUAGE javascript AS $$ - column.substring(0,num) +LANGUAGE javascript AS $$ + column.substring(0,num) $$; CREATE OR REPLACE FUNCTION cycling.fLog (input double) @@ -34,7 +36,7 @@ CREATE TABLE emp ( last_user text ); -select +select $my_tag$aoeuaoeu$my_tag$ as blah ; diff --git a/lexers/testdata/markdown.expected b/lexers/testdata/markdown.expected index e4506d6..d4b09cc 100644 --- a/lexers/testdata/markdown.expected +++ b/lexers/testdata/markdown.expected @@ -16,6 +16,10 @@ {"type":"GenericStrong","value":"**bold**"}, {"type":"Text","value":" on the "}, {"type":"GenericStrong","value":"**same line**"}, + {"type":"Text","value":".\n\nMultiple "}, + {"type":"GenericEmph","value":"_italic_"}, + {"type":"Text","value":" on the "}, + {"type":"GenericEmph","value":"*same_line*"}, {"type":"Text","value":".\n\n"}, {"type":"GenericSubheading","value":"## user defined function in cql\n"}, {"type":"Text","value":"\n"}, @@ -29,7 +33,7 @@ {"type":"Punctuation","value":","}, {"type":"NameOther","value":"num"}, {"type":"Punctuation","value":")"}, - {"type":"Text","value":" \n"}, + {"type":"Text","value":"\n"}, {"type":"LiteralString","value":"```"}, {"type":"Text","value":"\n\n"}, {"type":"LiteralString","value":"```cql\n"}, @@ -78,7 +82,7 @@ {"type":"Keyword","value":"AS"}, {"type":"TextWhitespace","value":" "}, {"type":"LiteralStringHeredoc","value":"$$"}, - {"type":"Text","value":" \n "}, + {"type":"Text","value":"\n "}, {"type":"NameOther","value":"column"}, {"type":"Punctuation","value":"."}, {"type":"NameOther","value":"substring"}, @@ -87,7 +91,7 @@ {"type":"Punctuation","value":","}, {"type":"NameOther","value":"num"}, {"type":"Punctuation","value":")"}, - {"type":"Text","value":" \n"}, + {"type":"Text","value":"\n"}, {"type":"LiteralStringHeredoc","value":"$$"}, {"type":"Punctuation","value":";"}, {"type":"TextWhitespace","value":"\n\n"}, @@ -191,7 +195,7 @@ {"type":"Punctuation","value":");"}, {"type":"Text","value":"\n\n"}, {"type":"Keyword","value":"select"}, - {"type":"Text","value":" \n "}, + {"type":"Text","value":"\n "}, {"type":"LiteralStringHeredoc","value":"$my_tag$aoeuaoeu$my_tag$"}, {"type":"Text","value":" "}, {"type":"Keyword","value":"as"},