55/**
66 * A callback function to handle the opening of container blocks.
77 * @callback OpenHandler
8- * @param {"correct" | "incorrect" } type The type of the example.
9- * @param {string } code The example code.
10- * @param {ParserOptions } parserOptions The parser options to be passed to the Playground.
11- * @param {Object } codeBlockToken The `markdown-it` token for the code block inside the container.
8+ * @param {Object } data Callback data.
9+ * @param {"correct" | "incorrect" } data.type The type of the example.
10+ * @param {string } data.code The example code.
11+ * @param {ParserOptions } data.parserOptions The parser options to be passed to the Playground.
12+ * @param {Object } data.codeBlockToken The `markdown-it` token for the code block inside the container.
13+ * @param {Object } data.env Additional Eleventy metadata, if available.
1214 * @returns {string | undefined } If a text is returned, it will be appended to the rendered output
1315 * of `markdown-it`.
1416 */
4345 *
4446 * markdownIt()
4547 * .use(markdownItContainer, "rule-example", markdownItRuleExample({
46- * open(type, code, parserOptions, codeBlockToken) {
48+ * open({ type, code, parserOptions, codeBlockToken, env } ) {
4749 * // do something
4850 * }
4951 * close() {
@@ -58,7 +60,7 @@ function markdownItRuleExample({ open, close }) {
5860 validate ( info ) {
5961 return / ^ \s * (?: i n ) ? c o r r e c t (? ! \S ) / u. test ( info ) ;
6062 } ,
61- render ( tokens , index ) {
63+ render ( tokens , index , options , env ) {
6264 const tagToken = tokens [ index ] ;
6365
6466 if ( tagToken . nesting < 0 ) {
@@ -77,7 +79,7 @@ function markdownItRuleExample({ open, close }) {
7779 . replace ( / \n $ / u, "" )
7880 . replace ( / ⏎ (? = \n ) / gu, "" ) ;
7981
80- const text = open ( type , code , parserOptions , codeBlockToken ) ;
82+ const text = open ( { type, code, parserOptions, codeBlockToken, env } ) ;
8183
8284 // Return an empty string to avoid appending unexpected text to the output.
8385 return typeof text === "string" ? text : "" ;
0 commit comments