File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Github \Api ;
4+
5+ /**
6+ * Markdown Rendering API
7+ *
8+ * @link http://developer.github.com/v3/markdown/
9+ * @author Joseph Bielawski <[email protected] > 10+ */
11+ class Markdown extends Api
12+ {
13+ /**
14+ * @param string $text
15+ * @param string $mode
16+ *
17+ * @return string
18+ */
19+ public function render ($ text , $ mode = 'markdown ' )
20+ {
21+ if (!in_array ($ mode , array ())) {
22+ $ mode = 'markdown ' ;
23+ }
24+
25+ return $ this ->post ('markdown ' , array (
26+ 'text ' => $ text ,
27+ 'mode ' => $ mode
28+ ));
29+ }
30+
31+ /**
32+ * @param string $file
33+ *
34+ * @return string
35+ */
36+ public function renderRaw ($ file )
37+ {
38+ return $ this ->post ('markdown/raw ' , array (
39+ 'file ' => $ file
40+ ));
41+ }
42+ }
Original file line number Diff line number Diff line change @@ -281,6 +281,20 @@ public function getPullRequestApi()
281281 return $ this ->apis ['pullrequest ' ];
282282 }
283283
284+ /**
285+ * Get the markdown API
286+ *
287+ * @return Api\Markdown the markdown API
288+ */
289+ public function getMarkdownApi ()
290+ {
291+ if (!isset ($ this ->apis ['markdown ' ])) {
292+ $ this ->apis ['markdown ' ] = new Api \Markdown ($ this );
293+ }
294+
295+ return $ this ->apis ['markdown ' ];
296+ }
297+
284298 /**
285299 * Inject an API instance
286300 *
You can’t perform that action at this time.
0 commit comments