-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e7752b
commit 36d808f
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script total> | ||
exports.id = 'codehighlighter'; | ||
exports.name = 'Code highlighter'; | ||
exports.author = 'Total.js'; | ||
exports.version = '1'; | ||
exports.preview = 'data:image/gif;base64,R0lGODdhLAHIAPcAAP///zlzAFtbW09PT+/v78rKyktLS/T09EREREhISJubm7y8vCBxmc/Pz9fX1+bm5pWVlVZWVufn52lpabe3t/Pz89HR0dnZ2ZiYmGJiYpOTk319fdra2vDw8GFhYa6urq+vr+Xl5cXFxVFRUdjY2La2tvv7+/X19Xh4eMXV3mtray14npS2yNvb24CAgM3NzbGxsd3d3Wpqam5ublRUVODg4GdnZ21tbe7u7nBwcKKioqSkpJ6enuPj4/Hy8r3Q2uDn6zuAo9DQ0L29vb7Q21GMrJK1x1OOrbS0tKioqGZmZuvr65eXl8LCwpCQkKampru7u1hYWOjo6NbW1qCgoPf39/n5+bm5ub+/v8TExIKCgurq6qurq6ysrPLy8pmZmZSUlLKyssnJyb6+voGBgampqcvLy1paWoiIiJycnOTk5GRkZIyMjOzs7MnY4KO/z+3v8O/x8nV1dcbTukR6CqnE0arE0nR0dHp6erLJ1ujs763BmYKrwM/c487a4mmTQN7m6ZaWloCqv5O1x9vj6PPz9FyUsIatwrvP2ZG0xsbX34yxxa2trWibtUaGp0mIqGOYs7vP2qvF0rHI1X+pv46yxZ27zNTU1Hl5eYuLi52dnaqqqt7e3ri4uMPQtvHx8bDEnvDx7+3v68HBwdzc3Ke9kqq/llaFI+np6a/Dnc/ZxcTRt9zj1vHy8OLi4o+Pj+3t7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BENaN330HPOEFMOxy1k3ZEb/OpAPHw+GzL5OdLEEK6mnyKxbOjGuMm/zphn/+OwAAl9jzYOqmfZUnfenRXpwjexCEx109ibv4xQ7A3sq+GXOZz5xmIAqRiEZEohJ5HvrcyJCGNhS+/278fMY0rhE4hH78oUPp1gYy2tHWbbvKOi1IQgbskIlEwCIPeWreTHKP4pcbscZMyEFrxqQcuJZ3B3dLAcgcwEaAxwFNDfgg7IRsybFN3TSBV2J6Gmgk3NaBJvKBIEgiIjiCR8KBJtgjJZiCG7KCLLgkKPiCNeKCMlgmMViDxUZ8OCgkNLiDG6iDPqiCGuEgQegjBlKE3qYRAIKERtggTNiESviEQrgR5yGFM2geVniFHQEdWZiDHlEbRNiFITIbZFiGZniGaJiGariGbNiGbviGcBiHcjiHdFiHdniHeJiHeriHfNiHfviHgBiIgjiIhFiIhniIiJiIiriIjNiIjiX4iJAYiZI4iZRYiZZ4iZiYiZq4iZzYiZ74iaAYiqI4iqTYGAEBADs='; | ||
exports.config = {}; | ||
exports.dependencies = ['https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js']; | ||
|
||
exports.render = function(opt, next) { | ||
|
||
var ready = ''; | ||
|
||
if (!opt.codehighlighter) { | ||
opt.codehighlighter = true; | ||
ready = '<scr' + 'ipt>$(document).ready(function(){hljs.highlightAll()});</scr' + 'ipt>'; | ||
} | ||
|
||
next(opt.html.replace(/<br(\s\/)?>/g, '\n') + ready, false, true); | ||
}; | ||
|
||
</script> | ||
|
||
<style> | ||
.CLASS pre, .CLASS .hljs { background-color: rgba(0,0,0,0.05); margin: 0; padding: 10px; border-radius: var(--radius); text-align: left; } | ||
.CLASS .hljs { background-color: transparent; } | ||
.CLASS pre code { display: inline-block; margin: 0; padding: 0; position: relative; width: 100%; } | ||
</style> | ||
|
||
<settings> | ||
|
||
<div class="padding"> | ||
<ui-component name="input" path="?.language" config="placeholder:auto"></ui-component> | ||
<div class="help">Example: <code>js</code>, <code>html</code> or <code>auto</code></div> | ||
</div> | ||
|
||
<script> | ||
exports.save = function(config, el) { | ||
var pre = el.find('pre').rclass2('language-'); | ||
if (config.language && config.language !== 'auto') | ||
pre.aclass('language-' + config.language); | ||
}; | ||
</script> | ||
|
||
</settings> | ||
|
||
<body> | ||
<pre><code class="CMS_edit CMS_multiline">Code highlighting</code></pre> | ||
</body> |