From f9b799db644fc46e56947bbf46b921af44c753d2 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 28 Jan 2025 11:51:18 +0000 Subject: [PATCH] Fix indent --- src/construct/partial_mdx_expression.rs | 16 +++++++--------- 1 file(s) changed, 7 insertion(s)(+), 9 deletion(s)(-) diff --git a/src/construct/partial_mdx_expression.rs b/src/construct/partial_mdx_expression.rs --- a/src/construct/partial_mdx_expression.rs +++ b/src/construct/partial_mdx_expression.rs @@ -64,7 +64,12 @@ use crate::util::mdx_collect::collect; use crate::{MdxExpressionKind, MdxExpressionParse, MdxSignal}; use alloc::boxed::Box; -pub const INDENT_SIZE: usize = 4; +// Tab-size to eat has to be the same as what we serialize as. +// While in some places in markdown that’s 4, in JS it’s more common as 2. +// Which is what’s also in `mdast-util-mdx-jsx`: +// +// +pub const INDENT_SIZE: usize = 2; /// Start of an MDX expression. /// @@ -191,15 +196,8 @@ // > `} /> eee // ``` // // Currently, the “paragraph” starts at `> | aaa`, so for the next line - // here we split it into `>␠|␠␠␠␠|␠d` (prefix, this indent here, + // here we split it into `>␠|␠␠|␠␠␠d` (prefix, this indent here, // expression data). - // The intention above is likely for the split to be as `>␠␠|␠␠␠␠|d`, - // which is impossible, but we can mimick it with `>␠|␠␠␠␠␠|d`. - // - // To improve the situation, we could take `tokenizer.line_start` at - // the start of the expression and move past whitespace. - // For future lines, we’d move at most to - // `line_start_shifted.column + 4`. tokenizer.enter(Name::LinePrefix); State::Retry(StateName::MdxExpressionPrefix) } else { -- tangled.sh