Created
June 16, 2016 10:32
-
-
Save Izaron/c881435623f5fc911d226f209b505fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String generateHtml(String codeTheme, String lineNumbersProperty, String font, String sourceCode) { | |
if (!lineNumbersProperty.isEmpty()) { | |
return "<link rel=\"stylesheet\" href=\"styles-hl/" + codeTheme + ".css\">\n" + | |
"<script src=\"highlight.pack.js\"></script>\n" + | |
"<script src=\"highlightjs-line-numbers.js\"></script>\n" + | |
"<script>hljs.initHighlightingOnLoad();</script>\n" + | |
"<script>hljs.initLineNumbersOnLoad();</script>\n" + | |
"<link rel=\"stylesheet\" href=\"lines.css\">\n" + | |
"<style type=\"text/css\">.hljs {\n" + | |
" font-family: \"" + font + "\";\n" + | |
"}\n" + | |
"</style>\n" + | |
"<html><body> <pre><code class=\"java\" >" + sourceCode + "</code></pre> </body></html>"; | |
} else { | |
return "<link rel=\"stylesheet\" href=\"styles-hl/" + codeTheme + ".css\">\n" + | |
"<script src=\"highlight.pack.js\"></script>\n" + | |
"<script>hljs.initHighlightingOnLoad();</script>\n" + | |
"<link rel=\"stylesheet\" href=\"lines.css\">\n" + | |
"<style type=\"text/css\">.hljs {\n" + | |
" padding-left: 0.5em;\n" + | |
" font-family: \"" + font + "\";\n" + | |
"}\n" + | |
"</style>\n" + | |
"<html><body> <pre><code class=\"java\" >" + sourceCode + "</code></pre> </body></html>"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment