mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Merge pull request #17 from litao91/fixlist
Fix inaccurate indent calculation of list_item and add extra test
This commit is contained in:
commit
36e42c4e73
3 changed files with 26 additions and 1 deletions
10
_test/extra.txt
Normal file
10
_test/extra.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
1
|
||||
//- - - - - - - - -//
|
||||
* A
|
||||
B
|
||||
//- - - - - - - - -//
|
||||
<ul>
|
||||
<li>A
|
||||
B</li>
|
||||
</ul>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
15
extra_test.go
Normal file
15
extra_test.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package goldmark
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/yuin/goldmark/renderer/html"
|
||||
)
|
||||
|
||||
func TestDefinitionList(t *testing.T) {
|
||||
markdown := New(WithRendererOptions(
|
||||
html.WithXHTML(),
|
||||
html.WithUnsafe(),
|
||||
))
|
||||
DoTestCaseFile(markdown, "_test/extra.txt", t)
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ func calcListOffset(source []byte, match [6]int) int {
|
|||
if util.IsBlank(source[match[4]:]) { // list item starts with a blank line
|
||||
offset = 1
|
||||
} else {
|
||||
offset, _ = util.IndentWidth(source[match[4]:], match[2])
|
||||
offset, _ = util.IndentWidth(source[match[4]:], match[4])
|
||||
if offset > 4 { // offseted codeblock
|
||||
offset = 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue