From b33a81e40620b8b3eaeeec9d0e0b34ca5958dead Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 28 Sep 2022 17:54:39 +0200 Subject: Add support for turning mdast to hast --- src/lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index fcdab10..e552327 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate alloc; mod construct; mod event; -pub mod mdast; +pub mod mdast; // To do: externalize? mod parser; mod resolve; mod state; @@ -25,6 +25,7 @@ mod subtokenize; mod to_html; mod to_mdast; mod tokenizer; +pub mod unist; // To do: externalize. mod util; use alloc::{boxed::Box, fmt, string::String}; @@ -32,6 +33,7 @@ use mdast::Node; use parser::parse; use to_html::compile as to_html; use to_mdast::compile as to_mdast; +use util::sanitize_uri::sanitize; /// Type of line endings in markdown. #[derive(Clone, Debug, Default, Eq, PartialEq)] @@ -146,7 +148,7 @@ pub enum MdxExpressionKind { /// Can be passed as `mdx_expression_parse` in [`Options`][] to support /// expressions according to a certain grammar (typically, a programming /// language). -pub type MdxExpressionParse = dyn Fn(&str, MdxExpressionKind) -> MdxSignal; +pub type MdxExpressionParse = dyn Fn(&str, &MdxExpressionKind) -> MdxSignal; /// Signature of a function that parses ESM. /// @@ -1187,3 +1189,9 @@ pub fn micromark_to_mdast(value: &str, options: &Options) -> Result String { + sanitize(value) +} -- cgit