From 694516d8120a5544f196c80e006d1056d09567d0 Mon Sep 17 00:00:00 2001 From: Patrick Janser Date: Tue, 10 Jun 2025 18:40:49 +0200 Subject: [PATCH 1/2] Update extend-parser.md to remove the old hooks no longer existant Also added some function headers to make it a bit clearer. --- docs/extend-parser.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/extend-parser.md b/docs/extend-parser.md index 2cff5fe5..bc3f9bed 100644 --- a/docs/extend-parser.md +++ b/docs/extend-parser.md @@ -4,21 +4,25 @@ Run `Markdown Preview Enhanced: Extend Parser (Global)` or `Markdown Preview Enh ```javascript ({ + /** + * Hook to modify the Markdown code before it is parsed. + * + * @param {String} markdown The original Markdown code. + * @returns {String} The modified Markdown code. + */ onWillParseMarkdown: async function(markdown) { return markdown; }, - onDidParseMarkdown: async function(html) { + /** + * Hook to modify the HTML output of the parser. + * + * @param {String} html The HTML code returned by the parser. + * @returns {String} The modified HTML code. + */ + onDidTransformMarkdown: async function(html) { return html; }, - - onWillTransformMarkdown: async function(markdown) { - return markdown; - }, - - onDidTransformMarkdown: async function(markdown) { - return markdown; - }, }); ``` From c96a313b2b75f0e374bba4e909ab46d4cf409b48 Mon Sep 17 00:00:00 2001 From: Patrick Janser Date: Tue, 10 Jun 2025 18:46:17 +0200 Subject: [PATCH 2/2] Did a mistake: wrong hook name. --- docs/extend-parser.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/extend-parser.md b/docs/extend-parser.md index bc3f9bed..377f61ce 100644 --- a/docs/extend-parser.md +++ b/docs/extend-parser.md @@ -20,7 +20,7 @@ Run `Markdown Preview Enhanced: Extend Parser (Global)` or `Markdown Preview Enh * @param {String} html The HTML code returned by the parser. * @returns {String} The modified HTML code. */ - onDidTransformMarkdown: async function(html) { + onDidParseMarkdown: async function(html) { return html; }, });