@@ -12,8 +12,8 @@ class HtmlUtils {
1212 String lang = 'java' ,
1313 userBR = true }) {
1414 String currentData = (mdData != null && ! mdData.contains ("<code>" ))
15- ? "<body>\n <pre class= \" pre \" >\n <code lang='$lang '>\n $mdData </code>\n </pre>\n </body>\n "
16- : "<body>\n <pre class= \" pre \" >\n ${mdData !}</pre>\n </body>\n " ;
15+ ? "<body>\n <pre>\n <code lang='$lang '>\n $mdData </code>\n </pre>\n </body>\n "
16+ : "<body>\n <pre>\n ${mdData !}</pre>\n </body>\n " ;
1717 return generateHtml (currentData,
1818 backgroundColor: backgroundColor, userBR: userBR);
1919 }
@@ -101,20 +101,8 @@ class HtmlUtils {
101101 String actionColor = GSYColors .actionBlueString,
102102 userBR = true }) {
103103 // ignore: prefer_interpolation_to_compose_strings
104- return "${"${"<html>\n " +
105- "<head>\n " +
106- "<meta charset=\" utf-8\" />\n " +
107- "<title></title>\n " +
108- "<meta name=\" viewport\" content=\" width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" />" +
109- "<meta name=\“ app-mobile-web-app-capable\” content=\“ yes\" /> " +
110- "<link href=\" https:\/\/ cdn.bootcss.com/highlight.js/9.12.0/styles/dracula.min.css\" rel=\" stylesheet\" >\n " +
111- "<script src=\" https:\/\/ cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js\" ></script> " +
112- "<script>hljs.configure({'useBR': ${userBR .toString ()}"
113- "});hljs.initHighlightingOnLoad();</script> " +
114- "<style>" +
115- "body{background: $backgroundColor "
116- };}a {color:$actionColor !important;}.highlight pre, pre { word-wrap: ${wrap ? "break-word" : "normal" }; white-space: ${wrap ? "pre-wrap" : "pre" }; }thead, tr {background:${GSYColors .miWhiteString };}td, th {padding: 5px 10px;font-size: 12px;direction:hor}.highlight {overflow: scroll; background: ${GSYColors .miWhiteString }}tr:nth-child(even) {background:${GSYColors .primaryLightValueString };color:${GSYColors .miWhiteString };}tr:nth-child(odd) {background: ${GSYColors .miWhiteString };color:${GSYColors .primaryLightValueString };}th {font-size: 14px;color:${GSYColors .miWhiteString };background:${GSYColors .primaryLightValueString };}</style></head>\n <body>\n " +
117- mdHTML }</body>\n </html>" ;
104+ return "${"${"<html>\n " + "<head>\n " + "<meta charset=\" utf-8\" />\n " + "<title></title>\n " + "<meta name=\" viewport\" content=\" width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" />" + "<meta name=\“ app-mobile-web-app-capable\” content=\“ yes\" /> " + "<link rel=\" stylesheet\" href=\" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css\" >\n " + "<script src=\" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js\" ></script>" + "<script src=\" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/go.min.js\" ></script>" + "<script>hljs.configure({'useBR': ${userBR .toString ()}"
105+ "});hljs.initHighlightingOnLoad();</script> " + "<style>" + "body{background: $backgroundColor " };}a {color:$actionColor !important;}.highlight pre, pre { word-wrap: ${wrap ? "break-word" : "normal" }; white-space: ${wrap ? "pre-wrap" : "pre" }; }thead, tr {background:${GSYColors .miWhiteString };}td, th {padding: 5px 10px;font-size: 12px;direction:hor}.highlight {overflow: scroll; background: ${GSYColors .miWhiteString }}tr:nth-child(even) {background:${GSYColors .primaryLightValueString };color:${GSYColors .miWhiteString };}tr:nth-child(odd) {background: ${GSYColors .miWhiteString };color:${GSYColors .primaryLightValueString };}th {font-size: 14px;color:${GSYColors .miWhiteString };background:${GSYColors .primaryLightValueString };}</style></head>\n <body>\n " + mdHTML }</body>\n </html>" ;
118106 }
119107
120108 static parseDiffSource (String ? diffSource, bool wrap) {
@@ -158,7 +146,8 @@ class HtmlUtils {
158146 lineNumberStr = getDiffLineNumber (
159147 curRemoveNumber == - 1 ? "" : ("$curRemoveNumber " ),
160148 curAddNumber == - 1 ? "" : ("$curAddNumber " ));
161- source = "$source <div $classStr >${wrap ? "" : lineNumberStr ! + getBlank (1 )}$line </div>" ;
149+ source =
150+ "$source <div $classStr >${wrap ? "" : lineNumberStr ! + getBlank (1 )}$line </div>" ;
162151 }
163152 return source;
164153 }
@@ -213,7 +202,7 @@ class HtmlUtils {
213202 }
214203 }
215204 lang ?? = defaultLang;
216- if ('markdown' == lang) {
205+ if ('markdown' == lang || 'md' == lang ) {
217206 return generateHtml (res.data, backgroundColor: GSYColors .miWhiteString);
218207 } else {
219208 return generateCode2HTml (res.data,
0 commit comments