diff --git a/markup_fmt/src/parser.rs b/markup_fmt/src/parser.rs index c1a4c0a..fa09ed8 100644 --- a/markup_fmt/src/parser.rs +++ b/markup_fmt/src/parser.rs @@ -1027,7 +1027,7 @@ impl<'s> Parser<'s> { Some((_, '}')) if matches!(pair_stack.last(), Some('$' | '{')) => { pair_stack.pop(); } - Some((_, '/')) => { + Some((_, '/')) if !matches!(pair_stack.last(), Some('\'' | '"' | '`')) => { if let Some((_, c)) = self.chars.next_if(|(_, c)| *c == '/' || *c == '*') { pair_stack.push(c); } diff --git a/markup_fmt/tests/fmt/astro/issue-9/7.astro b/markup_fmt/tests/fmt/astro/issue-9/7.astro new file mode 100644 index 0000000..6e2123b --- /dev/null +++ b/markup_fmt/tests/fmt/astro/issue-9/7.astro @@ -0,0 +1,8 @@ +--- +"//" +'//' +`//` +`//${ + // +}` +--- diff --git a/markup_fmt/tests/fmt/astro/issue-9/7.snap b/markup_fmt/tests/fmt/astro/issue-9/7.snap new file mode 100644 index 0000000..0e45230 --- /dev/null +++ b/markup_fmt/tests/fmt/astro/issue-9/7.snap @@ -0,0 +1,11 @@ +--- +source: markup_fmt/tests/fmt.rs +--- +--- +"//" +'//' +`//` +`//${ + // +}` +---