@@ -221,30 +221,45 @@ public function parse_string( $source_code, $vars = array() )
221221 */
222222 public function parse_markdown ( $ source_code , $ flavour = 'default ' )
223223 {
224- if ( ! class_exists ( 'Parsedown ' ) )
225- {
226- throw new Exception ( 'The Cebe Markdown must be loaded to use Parser with Markdown. ' );
227- }
228-
229224 if ( $ flavour === 'github ' )
230225 {
226+ if ( ! class_exists ( 'cebe\markdown\GithubMarkdown ' ) )
227+ {
228+ throw new Exception ( 'The Cebe Markdown GithubMarkdown Parser must be loaded to use Parser with Github Flavour. ' );
229+ }
230+
231231 // use github markdown
232232 $ markdown = new \cebe \markdown \GithubMarkdown ();
233233 return $ markdown ->parse ( $ source_code );
234234 }
235235 elseif ( $ flavour === 'github-paragraph ' )
236236 {
237+ if ( ! class_exists ( 'cebe\markdown\GithubMarkdown ' ) )
238+ {
239+ throw new Exception ( 'The Cebe Markdown GithubMarkdown Parser must be loaded to use Parser with Github Flavour. ' );
240+ }
241+
237242 // parse only inline elements (useful for one-line descriptions)
238243 $ markdown = new \cebe \markdown \GithubMarkdown ();
239244 return $ markdown ->parseParagraph ( $ source_code );
240245 }
241246 elseif ( $ flavour === 'extra ' )
242247 {
248+ if ( ! class_exists ( 'cebe\markdown\MarkdownExtra ' ) )
249+ {
250+ throw new Exception ( 'The Cebe Markdown GithubMarkdown Parser must be loaded to use Parser with Extra Flavour. ' );
251+ }
252+
243253 // use markdown extra
244254 $ markdown = new \cebe \markdown \MarkdownExtra ();
245255 return $ markdown ->parse ( $ source_code );
246256 }
247257
258+ if ( ! class_exists ( 'cebe\markdown\Markdown ' ) )
259+ {
260+ throw new Exception ( 'The Cebe Markdown Parser must be loaded to use Parser with Markdown. ' );
261+ }
262+
248263 // traditional markdown and parse full text
249264 $ markdown = new \cebe \markdown \Markdown ();
250265 return $ markdown ->parse ( $ source_code );
0 commit comments