@@ -64,7 +64,12 @@ use crate::util::mdx_collect::collect;
64
64
use crate :: { MdxExpressionKind , MdxExpressionParse , MdxSignal } ;
65
65
use alloc:: boxed:: Box ;
66
66
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 ;
68
73
69
74
/// Start of an MDX expression.
70
75
///
@@ -191,15 +196,8 @@ pub fn eol_after(tokenizer: &mut Tokenizer) -> State {
191
196
// ```
192
197
//
193
198
// 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,
195
200
// 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`.
203
201
tokenizer. enter ( Name :: LinePrefix ) ;
204
202
State :: Retry ( StateName :: MdxExpressionPrefix )
205
203
} else {
0 commit comments