Jump to content
Jonathan.M

Paste with indent?

Recommended Posts

Several times a day, I paste code into Markdown, e.g. on Github issues. Of course it's pasted exactly as-is, which means that I have to manually add 4 spaces to each line in order for it to be treated as a code block.

 

It'd be great if there were a workflow which would paste the code, prepending 4 spaces to each line in the process. Does this exist? It seems trivial, but I couldn't find anything out there.

 

Share this post


Link to post

On GitHub you can use fenced code blocks instead of indenting. It’s a lot easier that way, imo, because you don’t have to change the code.

 

Otherwise, I dare say you can’t find a workflow to do the indenting because people just use their code editor to do it, or didn’t think it was worth sharing such a trivial workflow.

Share this post


Link to post

As it so happens the code I usually paste usually contains fenced code blocks itself (long story) so I've got to use the indent method ... I do use my code editor today, but it's just such a pain (create new buffer in code editor, paste into code editor, block indent, copy from code editor, close buffer, paste to browser...)

 

Maybe I'll take a crack at it myself. 🙂 Thanks for the reply!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×