Code delimiter markdown injection by lang hint.

This commit is contained in:
David Russell 2017-11-15 09:03:49 +07:00
parent 4b224b8b3f
commit d776a34983

View File

@ -86,7 +86,7 @@ public class CodeService {
if(downStatus == 0) { if(downStatus == 0) {
String code = diskService.asText(pp, SOURCE_CODE); String code = diskService.asText(pp, SOURCE_CODE);
if(isMarkdown(codePath)) { if(isMarkdown(codePath, langHint)) {
code = prepMarkdown(code); code = prepMarkdown(code);
} }
theContent = buildCodeBlock(mdm.extractDelim(md), theContent = buildCodeBlock(mdm.extractDelim(md),
@ -147,9 +147,9 @@ public class CodeService {
.toString(); .toString();
} }
private boolean isMarkdown(String codePath) { private boolean isMarkdown(String codePath, String langHint) {
return (codePath != null) && return ((codePath != null) && codePath.endsWith(MARKDOWN_EXTENSION)) ||
codePath.endsWith(MARKDOWN_EXTENSION); (langHint != null && langHint.toLowerCase().equals("markdown"));
} }
/* /*