2
2
3
3
function page__content ($ content ) {
4
4
$ 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
+ ) {
6
11
return $ content ;
7
12
}
8
13
$ out = new \ParsedownExtraPlugin ;
@@ -18,7 +23,12 @@ function page__description($description) {
18
23
19
24
function page__title ($ title ) {
20
25
$ 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
+ ) {
22
32
return $ title ;
23
33
}
24
34
$ out = new \ParsedownExtraPlugin ;
@@ -33,4 +43,17 @@ function page__title($title) {
33
43
34
44
\Hook::set ('page.content ' , __NAMESPACE__ . "\\page__content " , 2 );
35
45
\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