b-sharpe/SlackStorm

add syntax highlighting

Opened this issue · 6 comments

Slack usually let's you set a syntax for snippets, perhaps this is possible with the plugin as well?

Thanks, super useful plugin!

And linenumbers corresponding to the actual ones would be amazing

currently there is no way to beautify input via snippets. The API only allows attachments or pre-text unfortunately. For the line numbers, I'm not sure what you mean, it currently does display the lines selected within the file?

@b-sharpe I yeah that would be really if there were some kind of syntax highlighting option (Integrate Markdown support?). As for the line numbers I think @gerbenvandijk had something like in the attached screenshot in mind (which would also be really cool to have)

Snippet styled with Markdown

public function sendToSlack($message)
{
    $this->submit($message);
}

PhpStorm screenshot: line numbers.

line_number_syntax_high

i might be wrong here, but isn't it possible by setting the file type of a snippet @b-sharpe ?

https://api.slack.com/types/file -> scroll down to "file types":

Possible filetype values include, but are not limited to the following:\
auto	Auto Detect Type
text	Plain Text
applescript	AppleScript
boxnote	BoxNote
c	C
csharp	C#
cpp	C++
css	CSS
csv	CSV
clojure	Clojure
coffeescript	CoffeeScript
cfm	Cold Fusion
d	D
dart	Dart
diff	Diff
dockerfile	Docker
erlang	Erlang
fsharp	F#
fortran	Fortran
go	Go
groovy	Groovy
html	HTML
handlebars	Handlebars
haskell	Haskell
haxe	Haxe
java	Java
javascript	JavaScript/JSON
kotlin	Kotlin
latex	LaTeX/sTeX
lisp	Lisp
lua	Lua
markdown	Markdown (raw)
matlab	MATLAB
mumps	MUMPS
ocaml	OCaml
objc	Objective-C
php	PHP
pascal	Pascal
perl	Perl
pig	Pig
post	Slack Post
powershell	PowerShell
puppet	Puppet
python	Python
r	R
ruby	Ruby
rust	Rust
sql	SQL
sass	Sass
scala	Scala
scheme	Scheme
shell	Shell
smalltalk	Smalltalk
swift	Swift
tsv	TSV
vb	VB.NET
vbscript	VBScript
velocity	Velocity
verilog	Verilog
xml	XML
yaml	YAML

@Nguimjeu @qikkeronline Unfortunately inline line numbers and code formatting are not something you can do via a incoming webhook, basically you are bound to what can be done here: https://api.slack.com/docs/messages/builder

The file types link is for attaching actual files via https://api.slack.com/methods/files.upload which is using the Web API + OAuth rather than webhooks

Clear, thanks for explaining @b-sharpe 👍