-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix task list checkbox toggle to work with YAML front matter #25184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
12e8424
90fa1a9
164a815
b42a109
03ed9c3
36f4caa
b0d8f8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,3 +520,40 @@ func TestMathBlock(t *testing.T) { | |
|
||
} | ||
} | ||
|
||
func TestTaskList(t *testing.T) { | ||
testcases := []struct { | ||
testcase string | ||
expected string | ||
}{ | ||
{ | ||
// data-source-position should take into account YAML frontmatter. | ||
`--- | ||
foo: bar | ||
--- | ||
- [ ] task 1`, | ||
`<details><summary><i class="icon table"></i></summary><table> | ||
<thead> | ||
Comment on lines
+531
to
+536
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe there could be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind. IIRC the render should work that way. But it is not a must. 😄 maybe there are some other tricks behind it. |
||
<tr> | ||
<th>foo</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</details><ul> | ||
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="19"/>task 1</li> | ||
</ul> | ||
`, | ||
}, | ||
} | ||
|
||
for _, test := range testcases { | ||
res, err := RenderString(&markup.RenderContext{Ctx: git.DefaultContext}, test.testcase) | ||
assert.NoError(t, err, "Unexpected error in testcase: %q", test.testcase) | ||
assert.Equal(t, test.expected, res, "Unexpected result in testcase %q", test.testcase) | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.