fix repos containing supplementary .md files
[mdref/mdref] / mdref / Reference.php
index 153004fdafc83dd75ea4e072fcad0c1afcc298a8..7c22dba37fee16e9b9b4cfd7b90746b892ced4fb 100644 (file)
@@ -43,5 +43,19 @@ class Reference implements \IteratorAggregate {
        public function getIterator() {
                return new \ArrayIterator($this->repos);
        }
+
+       public function formatString($string) {
+               $md = \MarkdownDocument::createFromString($string);
+               $md->compile(\MarkdownDocument::AUTOLINK);
+               return $md->getHtml();
+       }
        
+       public function formatFile($file) {
+               $fd = fopen($file, "r");
+               $md = \MarkdownDocument::createFromStream($fd);
+               $md->compile(\MarkdownDocument::AUTOLINK | \MarkdownDocument::TOC);
+               $html = $md->getHtml();
+               fclose($fd);
+               return $html;
+       }
 }