Code golf for the lazy
Java, 70 bytes

String A(String[]b){return"## "+b[0]+", "+b[1]+" bytes\n\n    "+b[2];}


Assumes b[0] is the language name, b[1] is the byte count, and b[2] is the code.

Making it compilable costs 9 bytes, resulting in a 79-byte non-standalone program:

class a{String A(String[]b){return"## "+b[0]+", "+b[1]+" bytes\n\n    "+b[2];}}


The equivalent monolithic program is 103 bytes long:

interface a{static void main(String[]A){System.out.print("## "+A[0]+", "+A[1]+" bytes\n\n    "+A[2]);}}


The monolithic one works with command line arguments, assuming these just like the non-standalone program:


First argument is the language name
Second argument is the byte count
Third argument is the code




Java (lambda expression), 56 48 bytes

(b)-&gt;"## "+b[0]+", "+b[1]+" bytes\n\n    "+b[2];


This is a java.util.function.Function&lt;String[], String&gt;.



None of these programs/functions handle multiline strings. To do so, simply replace b[2] and A[2] with b[2].replace("\n","\n    ") and A[2].replace("\n","\n    ") - doing so adds 23 bytes.