File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ export class PageEvent<out Model = unknown> extends Event {
139
139
* An event emitted when markdown is being parsed. Allows other plugins to manipulate the result.
140
140
*
141
141
* @see {@link MarkdownEvent.PARSE }
142
+ * @see {@link MarkdownEvent.INCLUDE }
142
143
*/
143
144
export class MarkdownEvent extends Event {
144
145
/**
@@ -162,6 +163,12 @@ export class MarkdownEvent extends Event {
162
163
*/
163
164
static readonly PARSE = "parseMarkdown" ;
164
165
166
+ /**
167
+ * Triggered on the renderer when this plugin includes a markdown file through a markdown include tag.
168
+ * @event
169
+ */
170
+ static readonly INCLUDE = "includeMarkdown" ;
171
+
165
172
constructor (
166
173
name : string ,
167
174
page : PageEvent ,
Original file line number Diff line number Diff line change @@ -95,7 +95,14 @@ output file :
95
95
path = Path . join ( this . includes ! , path . trim ( ) ) ;
96
96
if ( isFile ( path ) ) {
97
97
const contents = readFile ( path ) ;
98
- return contents ;
98
+ const event = new MarkdownEvent (
99
+ MarkdownEvent . INCLUDE ,
100
+ page ,
101
+ contents ,
102
+ contents
103
+ ) ;
104
+ this . owner . trigger ( event ) ;
105
+ return event . parsedText ;
99
106
} else {
100
107
this . application . logger . warn (
101
108
"Could not find file to include: " + path
You can’t perform that action at this time.
0 commit comments