From b2eb21bf888ff1411a9d5e1e72cce9e0e20b5596 Mon Sep 17 00:00:00 2001 From: Soon Date: Tue, 2 Jul 2024 16:24:13 +0800 Subject: [PATCH] chore(infra): typos (#50) --- CHANGELOG.md | 2 +- README.md | 2 +- crates/mdx_rs/src/lib.rs | 2 +- crates/mdx_rs/src/mdx_plugin_recma_jsx_rewrite.rs | 2 +- crates/mdx_rs/src/swc.rs | 2 +- crates/plugin_container/src/lib.rs | 2 +- crates/plugin_normalize_link/src/lib.rs | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efef988..61ea290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,7 +106,7 @@ ### Bug Fixes -* anchor missed when link exsited in header ([6504df2](https://github.com/web-infra-dev/mdx-rs/commit/6504df27555565aba8262326d5947b3427915fb2)) +* anchor missed when link existed in header ([6504df2](https://github.com/web-infra-dev/mdx-rs/commit/6504df27555565aba8262326d5947b3427915fb2)) diff --git a/README.md b/README.md index e4025db..75182bc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @rspress/mdx-rs -This is a Node.js binding for MDX compliation of [Rspress](https://rspress.dev) which is a modern documentation tool based on [Rspack](https://www.rspack.org/). +This is a Node.js binding for MDX compilation of [Rspress](https://rspress.dev) which is a modern documentation tool based on [Rspack](https://www.rspack.org/). It can be 10x+ faster than compiler in pure JavaScript version.The [benchmark](./benches/index.mjs) result of `@rspress/mdx-rs` vs `@mdx-js/mdx` is as follows: diff --git a/crates/mdx_rs/src/lib.rs b/crates/mdx_rs/src/lib.rs index 620c782..1083911 100644 --- a/crates/mdx_rs/src/lib.rs +++ b/crates/mdx_rs/src/lib.rs @@ -62,7 +62,7 @@ pub fn compile( let parse_options = ParseOptions { constructs: Constructs { frontmatter: true, - // Enable GFM Grammer + // Enable GFM Grammar gfm_autolink_literal: true, gfm_label_start_footnote: true, gfm_footnote_definition: true, diff --git a/crates/mdx_rs/src/mdx_plugin_recma_jsx_rewrite.rs b/crates/mdx_rs/src/mdx_plugin_recma_jsx_rewrite.rs index 1ab8f52..73c9f09 100644 --- a/crates/mdx_rs/src/mdx_plugin_recma_jsx_rewrite.rs +++ b/crates/mdx_rs/src/mdx_plugin_recma_jsx_rewrite.rs @@ -901,7 +901,7 @@ fn create_error_helper(development: bool, path: Option) -> ModuleItem { }, ]; - // Accept a source location (which might be undefiend). + // Accept a source location (which might be undefined). if development { parameters.push(Param { pat: Pat::Ident(BindingIdent { diff --git a/crates/mdx_rs/src/swc.rs b/crates/mdx_rs/src/swc.rs index 692c151..1f13232 100644 --- a/crates/mdx_rs/src/swc.rs +++ b/crates/mdx_rs/src/swc.rs @@ -279,7 +279,7 @@ fn swc_error_to_string(error: &SwcError) -> String { /// /// This is needed because for expressions, we use an API that parses up to /// a valid expression, but there may be more expressions after it, which we -/// don’t alow. +/// don’t allow. fn whitespace_and_comments(mut index: usize, value: &str) -> Result<(), (Span, String)> { let bytes = value.as_bytes(); let len = bytes.len(); diff --git a/crates/plugin_container/src/lib.rs b/crates/plugin_container/src/lib.rs index 5b2ec80..0a4665d 100644 --- a/crates/plugin_container/src/lib.rs +++ b/crates/plugin_container/src/lib.rs @@ -8,7 +8,7 @@ pub fn parse_title_from_meta(title_meta: &str) -> String { let mut title = title_meta; let quote = title_meta.chars().nth(6).unwrap(); if quote != '"' && quote != '\'' { - // ignore the last char, bacause it is "}" + // ignore the last char, because it is "}" let last_index = title.rfind("}").unwrap_or(title.len()); title = &title[6..last_index]; } else { diff --git a/crates/plugin_normalize_link/src/lib.rs b/crates/plugin_normalize_link/src/lib.rs index 3aaa47c..e26e956 100644 --- a/crates/plugin_normalize_link/src/lib.rs +++ b/crates/plugin_normalize_link/src/lib.rs @@ -2,7 +2,7 @@ use hast; use std::path::Path; const PROTOCOLS: &[&str] = &["http://", "https://", "mailto:", "tel:", "javascript:", "#"]; -const TEMP_VARIBLE: &str = "image_"; +const TEMP_VARIABLE: &str = "image_"; const IMAGE_EXTNAMES: &[&str] = &[".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp"]; const MD_EXTNAMES: &[&str] = &[".md", ".mdx"]; @@ -19,7 +19,7 @@ fn generate_ast_import( hast::MdxjsEsm { value: format!( "import {} from \"{}\";", - format!("{}{}", TEMP_VARIBLE, index), + format!("{}{}", TEMP_VARIABLE, index), import_path ), position: None, @@ -156,7 +156,7 @@ fn mdx_plugin_normalize_link_impl( name: "src".to_string(), value: Some(hast::AttributeValue::Expression( markdown::mdast::AttributeValueExpression { - value: format!("{}{}", TEMP_VARIBLE, index), + value: format!("{}{}", TEMP_VARIABLE, index), stops: vec![], }, )), @@ -210,7 +210,7 @@ fn mdx_plugin_normalize_link_impl( images.push(generate_ast_import(index, root, value, filepath)); property.value = Some(hast::AttributeValue::Expression( markdown::mdast::AttributeValueExpression { - value: format!("{}{}", TEMP_VARIBLE, index), + value: format!("{}{}", TEMP_VARIABLE, index), stops: vec![], }, ));