From fe618ff6e38ec0ed4da72a3935fd9ea64ee1cef5 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 19 Sep 2022 11:17:26 +0200 Subject: Add support for parsing MDX ESM, expressions This commit adds support for hooks that lets a user integrate another parser with `micromark-rs`, to parse ESM and expressions according to a particular grammar (such as a programming language, typically JavaScript). For an example integrating with SWC, see `tests/test_utils/mod.rs`. The integration occurs with two functions passed in `options`: `mdx_expression_parse` and `mdx_esm_parse`. The can signal back to micromark when they are successful, whether there is an error at the end (in which case micromark will try to parse more), or whether there is a syntax error (in which case micromark will crash). --- tests/gfm_table.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/gfm_table.rs') diff --git a/tests/gfm_table.rs b/tests/gfm_table.rs index b7f884a..8c46a30 100644 --- a/tests/gfm_table.rs +++ b/tests/gfm_table.rs @@ -1037,7 +1037,8 @@ bar "###, &Options { allow_dangerous_html: true, - ..gfm.clone() + constructs: Constructs::gfm(), + ..Options::default() } )?, r###"

Grave accents

@@ -1345,7 +1346,8 @@ b "###, &Options { allow_dangerous_html: true, - ..gfm.clone() + constructs: Constructs::gfm(), + ..Options::default() } )?, r###"

Blank line

-- cgit