Skip to content

Commit 537f107

Browse files
committed
add one more test
1 parent f0ef2e3 commit 537f107

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

modules/markup/markdown/markdown_math_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,19 @@ func TestMathRenderBlockIndent(t *testing.T) {
123123
\]
124124
`,
125125
`<pre class="code-block is-loading"><code class="chroma language-math display">
126-
\alpha
126+
\alpha
127+
</code></pre>
128+
`,
129+
},
130+
{
131+
"indent-mismatch",
132+
`
133+
\[
134+
\alpha
135+
\]
136+
`,
137+
`<pre class="code-block is-loading"><code class="chroma language-math display">
138+
\alpha
127139
</code></pre>
128140
`,
129141
},
@@ -135,7 +147,7 @@ func TestMathRenderBlockIndent(t *testing.T) {
135147
\]
136148
`,
137149
`<pre class="code-block is-loading"><code class="chroma language-math display">
138-
\alpha
150+
\alpha
139151
</code></pre>
140152
`,
141153
},

modules/markup/markdown/math/block_parser.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ func (b *blockParser) Continue(node ast.Node, reader text.Reader, pc parser.Cont
9494
}
9595
}
9696
}
97-
seg := text.NewSegmentPadding(segment.Start, segment.Stop, segment.Padding)
97+
start := segment.Start + giteaUtil.Iif(pos > block.Indent, block.Indent, pos)
98+
seg := text.NewSegmentPadding(start, segment.Stop, segment.Padding)
9899
node.Lines().Append(seg)
99100
return parser.Continue | parser.NoChildren
100101
}

0 commit comments

Comments
 (0)