static int hHiliteJava_timeout = 10000; static S hHiliteJava(S code) { ret hHiliteJava(code, null); } static S hHiliteJava(S code, S style) { S url = "http://hilite.me/api" + htmlQuery(+code, lexer := "java", divstyles := style); pcall { S html = loadPageWithTimeout(url, hHiliteJava_timeout); if (nempty(style)) { if (contains(style, "width:")) html = html.replace("width:auto;", ""); html = html.replace("<div style=\"", "<div style=\"" + style + "; "); } ret html; } ret hpre(htmlencode(code)); // fallback }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1006023 |
| Snippet name: | hHiliteJava - format Java(X) code using hilite.me |
| Eternal ID of this version: | #1006023/1 |
| Text MD5: | b914281d47e9780af5f033fb6573222e |
| Author: | stefan |
| Category: | javax / html |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-12-14 15:54:45 |
| Source code size: | 579 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 770 / 756 |
| Referenced in: | [show references] |