Skip to content

Commit 1decdc9

Browse files
Update
1 parent 41c2543 commit 1decdc9

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

index.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
function page__content($content) {
44
$type = $this->type;
5-
if ('Markdown' !== $type && 'text/markdown' !== $type) {
5+
if (
6+
'Markdown' !== $type &&
7+
'Parsedown' !== $type &&
8+
'text/markdown' !== $type &&
9+
'text/x-parsedown' !== $type
10+
) {
611
return $content;
712
}
813
$out = new \ParsedownExtraPlugin;
@@ -18,7 +23,12 @@ function page__description($description) {
1823

1924
function page__title($title) {
2025
$type = $this->type;
21-
if ('Markdown' !== $type && 'text/markdown' !== $type) {
26+
if (
27+
'Markdown' !== $type &&
28+
'Parsedown' !== $type &&
29+
'text/markdown' !== $type &&
30+
'text/x-parsedown' !== $type
31+
) {
2232
return $title;
2333
}
2434
$out = new \ParsedownExtraPlugin;
@@ -33,4 +43,17 @@ function page__title($title) {
3343

3444
\Hook::set('page.content', __NAMESPACE__ . "\\page__content", 2);
3545
\Hook::set('page.description', __NAMESPACE__ . "\\page__description", 2);
36-
\Hook::set('page.title', __NAMESPACE__ . "\\page__title", 2);
46+
\Hook::set('page.title', __NAMESPACE__ . "\\page__title", 2);
47+
48+
// Make property `$state->x->markdown` exist, so that other extension(s) that depend on the Markdown parser can continue
49+
// to work by checking if property `$state->x->markdown` is set:
50+
//
51+
// if (isset($state->x->markdown)) {
52+
// if (isset($state->x->markdown->vendor) && 'erusev/parsedown' === $state->x->markdown->vendor) {
53+
// // Using `erusev/parsedown`
54+
// } else {
55+
// // Using `taufik-nurrohman/markdown`
56+
// }
57+
// }
58+
//
59+
\State::set('x.markdown.vendor', 'erusev/parsedown');

0 commit comments

Comments
 (0)