Implement a whitespace golfer

Retina, 9 bytes

m`^\d
$* 

Try it online! Note: Trailing space on last line.


Cubically, 69 bytes

R1B1R3B1~(+50<7?6{+54>7?6{-002+7~?6{(@5*1-1/1)6}}}(-6>7?6&@7+70-4~)6)

Try it online!

Explanation:

First we do this initialization:

R1B1R3B1

To set up this cube:

   533
   004
   000
411223455441
311222331440
311222331440
   555
   555
   200

The most important thing about this cube is that face 5 sums to 32, which is the value required to print spaces. Coincidentally, it also happens to be fairly short for all other computation. After that is done:

~( . . . )                                    Takes the first input, then loops indefinitely

  +50<7?6{+54>7?6{-002+7~?6{(@5*1-1/1)6}}}    Handle leading digit:
  +50<7?6{                               }    If input is greater than 47 ('0' is 48)
          +54>7?6{                      }     And input is less than 58 ('9' is 57)
                                              Then input is a digit
                  -002+7                      Set notepad equal to value of input digit
                        ~                     Take next input (only convenient place for it)
                         ?6{           }      If the notepad isn't 0
                            (        )6       While the notepad isn't 0:
                             @5                 Print a space
                               *1-1/1           Decrement the notepad by one
                                              Leading digit handled

     (-6>7?6&@7+70-4~)6                       Handle rest of line:
     (               )6                       While the notepad isn't 0:
      -6>7?6&                                   Exit if End of Input
             @7                                 Print the next character
               +70-4                            Set notepad to 0 if it was a newline
                    ~                           Take the next character

Husk, 15 13 bytes

-2 bytes thanks to @Zgarb

mΓo+?oR' i;±¶

Try it online!

Uses the same technique as @Jonathan Allan

Explanation

             ¶  -- split input into a list of lines
m               -- apply the following function to each line
 Γ              --   deconstruct the string into a head and a tail
  o+            --   prepend to the tail of the string ...
    ?      ±    --     if the head is a digit (n)
     oR' i      --       the string of n spaces
                --     else
          ;     --       the head of the string
                -- implicitly print list of strings line-by-line