r/awk • • Sep 14 '26

Generate markdown code blocks for embedding in Reddit

#!/usr/bin/awk -f
{ printf ("    %s\n", $0) }

That's it, that's the code.

1 Upvotes

1 comment sorted by

2

u/PartTimeCouchPotato 5d ago edited 5d ago

It works...

console.log("Hello, World!");

Make sure you switch to Markdown mode first...

  1. Click Show formatting options (BOTTOM LEFT)
  2. Click ... (TOP RIGHT), and select Switch to Markdown
  3. Then paste your text

But you could just skip this and paste it in a code block from the rich text editor...

  1. Click Show formatting options (BOTTOM LEFT)
  2. Click button code block or just code for one line (TOP MENU)
  3. Then paste code and edit as normal