Skip to content

Commit dc77298

Browse files
committed
Fix wrongly detecting ``` as code block inside running text.
1 parent d070532 commit dc77298

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/commentcnv.l

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
%option prefix="commentcnvYY"
1919
%option reentrant
2020
%option extra-type="struct commentcnvYY_state *"
21+
%top{
22+
#include <stdint.h>
23+
}
2124

2225
%{
2326

@@ -349,15 +352,15 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z
349352
yyextra->blockName=&yytext[1];
350353
BEGIN(VerbatimCode);
351354
}
352-
<CComment,ReadLine>("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
355+
<CComment,ReadLine>^[ \t]*("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
353356
if (!Config_getBool(MARKDOWN_SUPPORT))
354357
{
355358
REJECT;
356359
}
357360
copyToOutput(yyscanner,yytext,(int)yyleng);
358361
yyextra->lastCommentContext = YY_START;
359362
yyextra->javaBlock=0;
360-
yyextra->blockName=QCString(yytext).left(3);
363+
yyextra->blockName=QCString(yytext).stripWhiteSpace().left(3);
361364
BEGIN(VerbatimCode);
362365
}
363366
<CComment,ReadLine>[\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
@@ -475,7 +478,7 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z
475478
}
476479
}
477480
}
478-
<Verbatim,VerbatimCode>[^@\/\\\n{}]* { /* any character not a backslash or new line or } */
481+
<Verbatim,VerbatimCode>[^`~@\/\\\n{}]* { /* any character not a backslash or new line or } */
479482
copyToOutput(yyscanner,yytext,(int)yyleng);
480483
}
481484
<Verbatim,VerbatimCode>\n { /* new line in verbatim block */

0 commit comments

Comments
 (0)