diff --git a/src/markdown.cpp b/src/markdown.cpp index 5ecb198f4f..32691d4c3d 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1366,7 +1366,9 @@ static bool isFencedCodeBlock(const char *data,int size,int refIndent, int startTildes=0; while (i=refIndent+4) return FALSE; // part of code block - while (i"```"[~]* { + static bool markdownSupport = Config_getBool("MARKDOWN_SUPPORT"); + if (!markdownSupport) + { + REJECT; + } + else + { + outputArray(yytext,(int)yyleng); + g_fenceSize=yyleng; + BEGIN(SkipVerbatim); + } + } [\\@][\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"code"("{"[^}]*"}")?){BN}+ { outputArray(yytext,(int)yyleng); g_yyLineNr+=QCString(yytext).contains('\n'); @@ -2606,6 +2619,13 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN(SkipCComment); } } +"```"[~]* { + outputArray(yytext,(int)yyleng); + if (g_fenceSize==yyleng) + { + BEGIN(SkipCComment); + } + } "*/"|"/*" { outputArray(yytext,(int)yyleng); } diff --git a/src/scanner.l b/src/scanner.l index 2e111cbab7..b9243c9b4e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -6271,6 +6271,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) g_nestedComment=FALSE; BEGIN(DocCopyBlock); } +"```"[~]* { + docBlock+=yytext; + docBlockName="```"; + g_fencedSize=yyleng; + g_nestedComment=FALSE; + BEGIN(DocCopyBlock); + } {B}*"" { if (insideCS) { @@ -6389,6 +6396,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(DocBlock); } } +"```"[~]* { + docBlock+=yytext; + if (g_fencedSize==yyleng) + { + BEGIN(DocBlock); + } + } [^\<@/*\]~\$\\\n]+ { // any character that is not special docBlock+=yytext; }