Skip to content

Commit f9b799d

Browse files
committed
Fix indent
1 parent 08c0460 commit f9b799d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/construct/partial_mdx_expression.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ use crate::util::mdx_collect::collect;
6464
use crate::{MdxExpressionKind, MdxExpressionParse, MdxSignal};
6565
use alloc::boxed::Box;
6666

67-
pub const INDENT_SIZE: usize = 4;
67+
// Tab-size to eat has to be the same as what we serialize as.
68+
// While in some places in markdown that’s 4, in JS it’s more common as 2.
69+
// Which is what’s also in `mdast-util-mdx-jsx`:
70+
// <https://github.com/syntax-tree/mdast-util-mdx-jsx/blob/40b951b/lib/index.js#L52>
71+
// <https://github.com/micromark/micromark-extension-mdx-expression/blob/7c305ff/packages/micromark-factory-mdx-expression/dev/index.js#L37>
72+
pub const INDENT_SIZE: usize = 2;
6873

6974
/// Start of an MDX expression.
7075
///
@@ -191,15 +196,8 @@ pub fn eol_after(tokenizer: &mut Tokenizer) -> State {
191196
// ```
192197
//
193198
// Currently, the “paragraph” starts at `> | aaa`, so for the next line
194-
// here we split it into `>␠|␠␠␠␠|␠d` (prefix, this indent here,
199+
// here we split it into `>␠|␠␠|␠␠␠d` (prefix, this indent here,
195200
// expression data).
196-
// The intention above is likely for the split to be as `>␠␠|␠␠␠␠|d`,
197-
// which is impossible, but we can mimick it with `>␠|␠␠␠␠␠|d`.
198-
//
199-
// To improve the situation, we could take `tokenizer.line_start` at
200-
// the start of the expression and move past whitespace.
201-
// For future lines, we’d move at most to
202-
// `line_start_shifted.column + 4`.
203201
tokenizer.enter(Name::LinePrefix);
204202
State::Retry(StateName::MdxExpressionPrefix)
205203
} else {

0 commit comments

Comments
 (0)