Last active
December 29, 2020 20:05
-
-
Save PedroHLC/0dc566f2cc4a9783eb0e85d37b49a7e1 to your computer and use it in GitHub Desktop.
[UserScript] Hightlights for Slack
This file contains hidden or 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
// ==UserScript== | |
// @name Hightlights for Slack | |
// @namespace https://pedrohlc.com/ | |
// @version 0.1.1 | |
// @downloadURL https://gist.github.com/PedroHLC/0dc566f2cc4a9783eb0e85d37b49a7e1/raw/slack.highlight.js | |
// @updateURL https://gist.github.com/PedroHLC/0dc566f2cc4a9783eb0e85d37b49a7e1/raw/slack.highlight.meta.js | |
// @description Slack code block syntax highlighting with highlight.js! | |
// @author PedroHLC | |
// @match app.slack.com/* | |
// @resource css https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.1/styles/default.min.css | |
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.1/highlight.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.1/languages/elm.min.js | |
// @require https://raw.githubusercontent.com/uzairfarooq/arrive/master/minified/arrive.min.js | |
// @grant GM_addStyle | |
// @grant GM_getResourceText | |
// ==/UserScript== | |
GM_addStyle("code, pre, .c-mrkdwn__pre {font-family: Fira Code !important; font-size: 13px !important; font-variant-ligatures: normal !important;}"); | |
GM_addStyle(GM_getResourceText("css")); | |
hljs.initHighlightingOnLoad(); | |
unsafeWindow.hljs = hljs; | |
document.arrive(".c-mrkdwn__pre", function() { | |
var content = this.innerText.split('\n'); | |
var lang = content[0]; | |
this.className += " lang-"+lang; | |
this.innerText = content.slice(1).join('\n'); | |
window.hljs.highlightBlock(this); | |
}); |
This file contains hidden or 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
// ==UserScript== | |
// @name Hightlights for Slack | |
// @namespace https://pedrohlc.com/ | |
// @version 0.1.1 | |
// @description Slack code block syntax highlighting with highlight.js! | |
// @author PedroHLC | |
// @match app.slack.com/* | |
// @resource css https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.1/styles/default.min.css | |
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.1/highlight.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.1/languages/elm.min.js | |
// @require https://raw.githubusercontent.com/uzairfarooq/arrive/master/minified/arrive.min.js | |
// @grant GM_addStyle | |
// @grant GM_getResourceText | |
// ==/UserScript== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add language name in first line! E.g.:
```ruby
example = 0x50
```