How to Show Source Code on Reddit

October 3rd, 2020

Filed under: None | Be the first to comment!

I see many people who ask a programming question on Reddit and do one of two things to show their code:

  • They show a screenshot of their screen.
  • They use the inline code setting instead of creating a code block.

By doing these things, the people asking the question make their code extremely difficult to read, making it less likely they will get an answer.


Notice how the code isn’t indented properly in the inline code block above. This sample isn’t too bad, but I have seen long inline code blocks that are almost unreadable.

The way to make a code listing readable on Reddit is to create a Markdown code block. Start by clicking the Markdown mode button on the right side of the toolbar above the text view for writing the post.


Write your post in Markdown. Any paragraphs you write will appear as normal body text in the final post. To create a code block, put three backticks on the line above the code listing and three more on the line below the listing.

// Put your code listing here
override func viewDidLoad() {
    // Do view setup here.

Then we you click the Post button, your code listing will appear in a block similar to the listing above, minus the backticks above and below the code.

By using Markdown code blocks for code listings in Reddit, your code will be much easier to read. People will be more likely to answer your question because you took the time to make an easy to read listing.

Leave a Reply

Your email address will not be published. Required fields are marked *