Code snippet with preview
It would be really nice to have preview boxes of long code blocks (Code snippets).
It should be cropped if there are more then x lines (maybe configurable), and could be opened in a new tab or fade out within the chat. An extra code viewer "window" would be nice.
It is really easy to do so:
Add a span/div element within the code block, give it absolute bottom position and a height (50px here), give it a gradient bg color and give the code block a max-height with overflow hidden. there you go.
The feature is under review. Would anyone would be interested contributing the improvement if we made it a help wanted ticket? https://docs.mattermost.com/process/help-wanted.html
According to the documentation the existing code blocks should generate line numbers. They don't. This is one feature that would be an essential component of Code Snippets.
Hi TJ Gienger, thank you for your interest in helping out with the feature, do you have any questions about how to get started?
TJ Gienger commented
I may be willing to help out.
Nate R. commented
This would be immensely helpful; I find myself sending log files (many times daily) for collaborating on bug fixing. First, I end up truncating out a bunch of potentially relevant information to take it down to 4000 characters. Second, even when it is 4000 characters, it ends up taking up all of the conversation window which is distracting and can derail other conversations which are going on in the same channel.
Any progress on this suggestion?
Ariel Balter commented
I see that this is labeled "won't fix." If I understand the question, it is to replicate the "code snippet" feature in slack. I think that is a very important feature to clone, and should be on the map, not in "won't fix."
Josue Rivera commented
Can this be submitted as a UX improvement to the code format render? For example if code is larger than x lines it gets truncated in to a in to a 2 or 3 line snippet with a preview click? I'm not talking about a new feature, but improving on the markdown method already implemented. This would make it easier to share big chunks of code without needed to writing it to a external editor and sharing a file. Unless they could consider a internal txt editor?
I would, If I would have time. At the moment, this is not the case - sorry for that. But maybe I can have a look in ~2 Weeks
Appreciate your feedback. Understand your request better now. Is this a feature you're interested in contributing?
I am not quite sure if I am to stupid, or you missunderstood me.
I am running mattermost 2.1 and when I add a code block like
[lots of lines of code]
i'll get a post where I can see all the lines of code.
But what I am requesting is that the code preview gets cropped after some lines and can be fully viewed in an extra window or whatever.