From d776a349831c55adefa1e0cac24455de85ec726e Mon Sep 17 00:00:00 2001 From: David Russell Date: Wed, 15 Nov 2017 09:03:49 +0700 Subject: [PATCH] Code delimiter markdown injection by lang hint. --- app/com/gitpitch/services/CodeService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/com/gitpitch/services/CodeService.java b/app/com/gitpitch/services/CodeService.java index 6d94432..090bf93 100644 --- a/app/com/gitpitch/services/CodeService.java +++ b/app/com/gitpitch/services/CodeService.java @@ -86,7 +86,7 @@ public class CodeService { if(downStatus == 0) { String code = diskService.asText(pp, SOURCE_CODE); - if(isMarkdown(codePath)) { + if(isMarkdown(codePath, langHint)) { code = prepMarkdown(code); } theContent = buildCodeBlock(mdm.extractDelim(md), @@ -147,9 +147,9 @@ public class CodeService { .toString(); } - private boolean isMarkdown(String codePath) { - return (codePath != null) && - codePath.endsWith(MARKDOWN_EXTENSION); + private boolean isMarkdown(String codePath, String langHint) { + return ((codePath != null) && codePath.endsWith(MARKDOWN_EXTENSION)) || + (langHint != null && langHint.toLowerCase().equals("markdown")); } /*