src/Classes/Markdown.php
public function markdownLink($file_path, $type = '')
    {

        $array = explode('/', $file_path);
        $dir = $array[0];

        $replace = array('-', '_');

        $url = trim($dir, '.md');
        $display_name = str_replace($replace, ' ', trim($dir, '.md'));

        if (count($array) > 1) {
            $name = trim($array[1], '.md');
            $url = $dir . '?page=' . $name;
            $display_name = str_replace($replace, ' ', $name);
        }

        $link = ($type == 'url') ? '/md/' . $url :
            '<a href="/md/' . $url . '" class="markdown-link">' . $display_name .
            '</a>';
        return $link;

    }
public function markdownLink($file_path, $type = '')
    {

        $array = explode('/', $file_path);
        $dir = $array[0];

        $replace = array('-', '_');

        $url = trim($dir, '.md');
        $display_name = str_replace($replace, ' ', trim($dir, '.md'));

        if (count($array) > 1) {
            $name = trim($array[1], '.md');
            $url = $dir . '?page=' . $name;
            $display_name = str_replace($replace, ' ', $name);
        }

        $link = ($type == 'url') ? '/md/' . $url :
            '<a href="/md/' . $url . '" class="markdown-link">' . $display_name .
            '</a>';
        return $link;

    }
public function markdownLink ( $ file_path , $ type = '' ) { $ array = explode ( '/' , $ file_path ) ; $ dir = $ array [ 0 ] ; $ replace = array ( '-' , '_' ) ; $ url = trim ( $ dir , '.md' ) ; $ display_name = str_replace ( $ replace , ' ' , trim ( $ dir , '.md' ) ) ; if ( count ( $ array ) > 1 ) { $ name = trim ( $ array [ 1 ] , '.md' ) ; $ url = $ dir . '?page=' . $ name ; $ display_name = str_replace ( $ replace , ' ' , $ name ) ; } $ link = ( $ type == 'url' ) ? '/md/' . $ url : '<a href="/md/' . $ url . '" class="markdown-link">' . $ display_name . '</a>' ; return $ link ; }
Converts a give md file path to a link

@param  string $file_path file path
@param  string $type      url/link
@return mixed
Converts a give md file path to a link