How to output a large amount of html markup I need to output an entire region of a page from within my custom module.

I know I can output markup to be rendered with this code:

$page['region'] = array(
    '#type' =&gt; 'markup',
    '#markup' =&gt; t('markup here'),
);


This is good for small amount of markup but is there a better way to output a large amount of html from within my module?
You shouldn't output large amount of markup from your module without using the theme layer (unless your markup is actually editable content or large chunk of static content). So, the best is probably to define a theme function or template for your markup, and use it from your module. This way, any theme can change your markup without affecting your module logic. Even if this is supposed to be a single-project custom module, chances are that someday you, or somebody else, will have to update this site. Properly separating your module logic from its presentation will make things easier in the future.

// Rendering code
  $page['region'] = array(
      '#theme' =&gt; 'custom_foo',
      '#foo' =&gt; t('foo)',
      '#bar' =&gt; t('bar'),
      '#count' =&gt; 42
  );

/**
 * Implements hook_theme().
 */
function custom_theme() {
  return array(
    'custom_foo' =&gt; array(
       'variables' =&gt; array('foo' =&gt; NULL, 'bar' =&gt; NULL, 'count' =&gt; NULL),
     )
  );
}

/**
 * Default theme implementation for custom_foo.
 */
function theme_custom_foo($variables) {
  $output[] = '';
  for ($i = 0; $i &lt; $variables['count']; $i++) {
    $output[] = array(
      'type' =&gt; '#markup',
      'markup' =&gt; ($i % 2 == 0) ? $variables['foo'] : $variables['bar'],
    )
  }
  return $output;
}


For static content, you can use a template (.tpl.php) instead of a theme function. This allow you to keep it outside a your .module (or .inc) file code. Again, this will be easier to maintain in the future.

Also, most of the time you shouldn't put markup into t(). t() is for translatable strings and most markup are not to be translated. One common, an acceptable, exceptions is (simple) link markup.