function listFilesInFolder($dir)
{
    $files = preg_grep('/^([^.])/', scandir($dir));
    sort($files);
    echo '<ul class="sg-nav-group">';
    foreach ($files as $file) {
        $path = $dir . '/' . $file;
        if (is_dir($path)) {
            echo '<li class="sg-subnav-parent">';
            renderTitleFromPath($path, 'h2');
            listFilesInFolder($path);
            echo '</li>';
        } else {
            echo '<li>';
            renderTitleFromPath($path, '');
            echo '</li>';
        }
    }
    echo '</ul>';
}
    <div id="nav" class="sg-sidebar" role="navigation">
      <h2 class="sg-h2 sg-subnav-title">About</h2>
      <ul class="sg-nav-group">
        <li>
          <a href="#sg-about">Getting Started</a>
        </li>
        <li>
          <a href="#sg-colors">Colors</a>
        </li>
        <li>
          <a href="#sg-fontStacks">Fonts</a>
        </li>
      </ul>

      <?php 
listFilesInFolder('markup');
?>
    </div><!--/.sg-sidebar-->

    <div id="main" class="sg-main" role="main">
      <div class="sg-container">
        <div class="sg-info">
          <div class="sg-about sg-section">
            <h2 id="sg-about" class="sg-h2">Getting Started</h2>
            <p>A living style guide is a great tool to promote visual consistency, unify UX designers and front-end developers, as well as speed up development times. Add some documentation here on how to get started with your new style guide and start customizing this boilerplate to your liking.</p>
            <p>If you are looking for resources on style guides, check out <a href="http://styleguides.io">styleguides.io</a>. There are a ton of great articles, books, podcasts, talks, and other style guide tools!</p>
          </div><!--/.sg-about-->

          <!-- Manually add your UI colors here. -->
          <div class="sg-colors sg-section">
            <h2 id="sg-colors" class="sg-h2">Colors</h2>