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). --- Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index 53b2a62..16c0622 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,8 +24,11 @@ unicode-id = { version = "0.3", features = ["no_std"] } [dev-dependencies] env_logger = "0.9" -criterion = "0.3" +criterion = "0.4" pretty_assertions = "1" +swc_common = "0.28" +swc_ecma_parser = "0.119" +swc_ecma_ast = "0.91" [build-dependencies] regex = "1" -- cgit